[Zope-DB] Zope-DB Digest, Vol 72, Issue 1

Richard Harley richard at scholarpack.com
Wed Aug 25 06:04:24 EDT 2010


Please can someone explain why ORM is better than speaking directly to 
the database? Isn't this just  adding another layer of complexity which 
in huge databases is certainly not needed.


On 24/08/10 17:00, zope-db-request at zope.org wrote:
> Send Zope-DB mailing list submissions to
> 	zope-db at zope.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://mail.zope.org/mailman/listinfo/zope-db
> or, via email, send a message with subject or body 'help' to
> 	zope-db-request at zope.org
>
> You can reach the person managing the list at
> 	zope-db-owner at zope.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Zope-DB digest..."
>
>
> Today's Topics:
>
>     1. ZSQL Question - Insert multiple rows in one statement?
>        (Mark Phillips)
>     2. Re: ZSQL Question - Insert multiple rows in one statement?
>        (Andreas Jung)
>     3. Re: ZSQL Question - Insert multiple rows in one statement?
>        (Sascha Gottfried)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 24 Aug 2010 08:03:21 -0700
> From: Mark Phillips<mark at phillipsmarketing.biz>
> Subject: [Zope-DB] ZSQL Question - Insert multiple rows in one
> 	statement?
> To: zope-db at zope.org
> Message-ID:
> 	<AANLkTinwD33h-HP1UpzWLyoFL3U12qCFDZ9pJmvdYg_c at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> When I retrieve multiple values from a selection box, I need to create a
> loop somewhere to insert the multiple values (rows) into a table. Is there a
> way to do this within a ZSQL statement, or is it best to do the looping in a
> Python script?
>
> My specific example....
>
> table 1 (Players) has information about players (i.e. team members for a
> sports team). There is a primary key - playerID
> table 2 (Seasons) has information about each season - primary key is
> seasonID
> table 3 (PlayerSeasons) has two columns - playerID and seasonID.
>
> The form to crud a player has a combobox where one can select multiple
> seasons for a player. When I do an add or update, I have to add one or more
> rows to the PlayerSeasons table. Does this loop have to be in a Python
> script, or can it be implemented in ZSQL? I looked at the 'multiple'
> keyword, but all the examples indicate that it apples to sql tests, such as
> testing against a set of values. I can't seem to find any examples where one
> is inserting multiple rows into a table.
>
> Thanks!
>
> Mark
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.zope.org/pipermail/zope-db/attachments/20100824/e5237d80/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 24 Aug 2010 17:06:21 +0200
> From: Andreas Jung<lists at zopyx.com>
> Subject: Re: [Zope-DB] ZSQL Question - Insert multiple rows in one
> 	statement?
> To: Mark Phillips<mark at phillipsmarketing.biz>
> Cc: zope-db at zope.org
> Message-ID:<4C73DFED.2000100 at zopyx.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I would assume that you can use DTML-IN for looping and generating
> multiple SQL statements of the same kind. You have to ensure that
> the statements having a proper delimiter (there was something in DTML?!
> DTML-SQLDELIMITER?...no idea, you need to checks the docs of this
> ancient technology).
>
> - -aj
>
> Mark Phillips wrote:
>    
>> When I retrieve multiple values from a selection box, I need to create a
>> loop somewhere to insert the multiple values (rows) into a table. Is
>> there a way to do this within a ZSQL statement, or is it best to do the
>> looping in a Python script?
>>
>> My specific example....
>>
>> table 1 (Players) has information about players (i.e. team members for a
>> sports team). There is a primary key - playerID
>> table 2 (Seasons) has information about each season - primary key is
>> seasonID
>> table 3 (PlayerSeasons) has two columns - playerID and seasonID.
>>
>> The form to crud a player has a combobox where one can select multiple
>> seasons for a player. When I do an add or update, I have to add one or
>> more rows to the PlayerSeasons table. Does this loop have to be in a
>> Python script, or can it be implemented in ZSQL? I looked at the
>> 'multiple' keyword, but all the examples indicate that it apples to sql
>> tests, such as testing against a set of values. I can't seem to find any
>> examples where one is inserting multiple rows into a table.
>>
>> Thanks!
>>
>> Mark
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Zope-DB mailing list
>> Zope-DB at zope.org
>> https://mail.zope.org/mailman/listinfo/zope-db
>>      
>
> - -- 
> ZOPYX Limited           | zopyx group
> Charlottenstr. 37/1     | The full-service network for Zope&  Plone
> D-72070 T?bingen        | Produce&  Publish
> www.zopyx.com           | www.produce-and-publish.com
> - ------------------------------------------------------------------------
> E-Publishing, Python, Zope&  Plone development, Consulting
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQGUBAEBAgAGBQJMc9/tAAoJEADcfz7u4AZjlPwLwNiLG+kZUrlZ+BuFEWKL42eE
> bmzllHixdEq6qy2gHP3pbf5AmICS66JJGfqaI6Gv7JqxY6XM1N35oeXK7PzUk+gb
> PYPtIwN62HMQzrvYXB6JHyFEkyMuOd9MFyyHMgh24JqC6xtMBbYI3+yjiXJor1QP
> Xd56qoxWmhHZVnC2YhddpR3DLlAx/qebi2mk+C15g2C+LkVzz0J2rHb5FNB/Izdt
> uJmknn9pDjBewSQhtPIsX/rj7R4SUtJUZ78H8Isn2yoEftsG4ONtpzT3O9ICXF4R
> Y4V/iV9KepUoxU5dpH9YDTl00YA6UVvyafhDufkPzq5dnKUQL+QzPXFcmC9tSRux
> OIDiTOLZwYVS0a5hT/OUtYB1p+JGhITxLKxspXH4vJ5po8IJR7CmxO0FOooqGeOc
> muaWclDrxPIsyWEAEZg6+ahyydWgFCePuMLCrEEvhZRpx4DxvhisXRVB5V/h6Z7L
> OSSYDljCM/mu1mKIPRUuHqBlc0mB4qI=
> =1o0Q
> -----END PGP SIGNATURE-----
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: lists.vcf
> Type: text/x-vcard
> Size: 316 bytes
> Desc: not available
> Url : http://mail.zope.org/pipermail/zope-db/attachments/20100824/7935a0d8/attachment-0001.vcf
>
> ------------------------------
>
> Message: 3
> Date: Tue, 24 Aug 2010 17:55:29 +0200
> From: Sascha Gottfried<s.gottfried at srz.de>
> Subject: Re: [Zope-DB] ZSQL Question - Insert multiple rows in one
> 	statement?
> To: zope-db at zope.org
> Message-ID:<4C73EB71.8080909 at srz.de>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Mark,
>
> it is best to do the looping in python. consider the python script as
> the proper place to process the form values taken from the request
> variable. No problem to invoke multiple zsql method calls from within
> this script. I even remember that all invoked zsql methods in one
> requests belong to a transaction. If one fails, a rollback is done. Your
> ZSQL connection has to be configured properly to use transactions and
> your server has to support them as well.
>
> Just in case you do not already found this - latest zope book and the
> chapter about SQL connectivity
> http://docs.zope.org/zope2/zope2book/RelationalDatabases.html
>
> Am 24.08.2010 17:03, schrieb Mark Phillips:
>    
>> When I retrieve multiple values from a selection box, I need to create
>> a loop somewhere to insert the multiple values (rows) into a table. Is
>> there a way to do this within a ZSQL statement, or is it best to do
>> the looping in a Python script?
>>
>> My specific example....
>>
>> table 1 (Players) has information about players (i.e. team members for
>> a sports team). There is a primary key - playerID
>> table 2 (Seasons) has information about each season - primary key is
>> seasonID
>> table 3 (PlayerSeasons) has two columns - playerID and seasonID.
>>
>> The form to crud a player has a combobox where one can select multiple
>> seasons for a player. When I do an add or update, I have to add one or
>> more rows to the PlayerSeasons table. Does this loop have to be in a
>> Python script, or can it be implemented in ZSQL? I looked at the
>> 'multiple' keyword, but all the examples indicate that it apples to
>> sql tests, such as testing against a set of values. I can't seem to
>> find any examples where one is inserting multiple rows into a table.
>>
>> Thanks!
>>
>> Mark
>>
>>
>> _______________________________________________
>> Zope-DB mailing list
>> Zope-DB at zope.org
>> https://mail.zope.org/mailman/listinfo/zope-db
>>
>>
>>
>> __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 5393 (20100824) __________
>>
>> E-Mail wurde gepr?ft mit ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>      
>
>
>
> __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 5393 (20100824) __________
>
> E-Mail wurde gepr?ft mit ESET NOD32 Antivirus.
>
> http://www.eset.com
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.zope.org/pipermail/zope-db/attachments/20100824/5dcd37b0/attachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> https://mail.zope.org/mailman/listinfo/zope-db
>
>
> End of Zope-DB Digest, Vol 72, Issue 1
> **************************************
>    



More information about the Zope-DB mailing list