[PonyORM-list] pony entities in multiple modules

Goldberg, Arthur P arthur.p.goldberg at mssm.edu
Wed Nov 5 18:46:15 UTC 2014


On Nov 5, 2014, at 1:29 PM, Arthur Goldberg <Arthur.Goldberg at mssm.edu<mailto:Arthur.Goldberg at mssm.edu>>
 wrote:

Hello Alexander

 let me be more specific.
 I have a number of modules that query, update, delete against the database.
 I want to centralize all the database bind, mapping,  and table deletion operations in one module that other modules can call.
 Here's my effort to write that centralized module.
 The only method is:
Connect( DBMS='arthur_minerva', entityNames=[], dropAndCreateTable=False, debug=False )
DBMS is simply a key into a dictionary of database credential parameters. That works fine, and is used by bind.
entityNames is a list of entities;  I want to connect() to make sure that if an  entity is declared as a pony db  entity then it is in the database
dropAndCreateTable  controls whether tables are dropped; if it is true then tables for all entities should be dropped and then created

 with the call:
Connect( MyDropAndCreateTables.args.DBMS, entityNames='CNV Subject'.split(),
            dropAndCreateTable=True, debug=True )
 this does not work, however:

it generates this error:
b4 db.bind
GET NEW CONNECTION
RELEASE CONNECTION
db.bind
b4 db.generate_mapping
GET CONNECTION FROM THE LOCAL POOL
SET foreign_key_checks = 0
COMMIT
SET foreign_key_checks = 1
CLOSE CONNECTION
db.generate_mapping
entity: CNV
entityObj: <class 'geneticsClasses.CNV'>
geneticsDBMScommon.pyc: WARNING: Pony MappingError: Database object is not bound with a provider yet
geneticsDBMScommon.pyc: WARNING: Cannot drop_table()



I am using mysql.

On Nov 4, 2014, at 4:39 PM, Alexander Kozlovsky <alexander.kozlovsky at gmail.com<mailto:alexander.kozlovsky at gmail.com>> wrote:
Hi Arthur,

> How can I have the general purpose programs load all the pony entities, but then use only those specified on a command line?

What do you mean by 'use'? Why this general purpose program can't use all entities? Can you provide some example?


On Wed, Nov 5, 2014 at 12:24 AM, Goldberg, Arthur P <arthur.p.goldberg at mssm.edu<https://urldefense.proofpoint.com/v2/url?u=http-3A__mailto-3Aarthur.p.goldberg-40mssm.edu&d=AAMFaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=-l9d_YgpS5Br4HVerevDUPDePIdahRQvh6kua6GEKCg&s=8BLVACjagdDyNx90SlAn1F7tsSllEw4K5MHFxb6KM1o&e=>> wrote:
Hi Guys

I've pony entities (class foo(db.Entity), etc.) definitions in multiple modules. And I've several general purpose programs: 1) connect to the dbms and optionally create tables, 2) load a file into a table, etc.
How can I have the general purpose programs load all the pony entities, but then use only those specified on a command line?

Is this clear?

thanks
Arthur

_______________________________________________
ponyorm-list mailing list
ponyorm-list at ponyorm.com<mailto:ponyorm-list at ponyorm.com>
/ponyorm-list<https://urldefense.proofpoint.com/v2/url?u=https-3A__mailman-2Dmail5.webfaction.com_listinfo_ponyorm-2Dlist&d=AAMFaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=-l9d_YgpS5Br4HVerevDUPDePIdahRQvh6kua6GEKCg&s=ZTWdoePYiHrdwy3YThpUs2-mmvop7hGq2ibwteX9CYA&e=>

_______________________________________________
ponyorm-list mailing list
ponyorm-list at ponyorm.com<mailto:ponyorm-list at ponyorm.com>
https://urldefense.proofpoint.com/v2/url?u=https-3A__mailman-2Dmail5.webfaction.com_listinfo_ponyorm-2Dlist&d=AAIGaQ&c=4R1YgkJNMyVWjMjneTwN5tJRn8m8VqTSNCjYLg1wNX4&r=TntoeYH7lekXzpBRjXwLTkqiWTbWAvp3pHKo_kZp5qI&m=-l9d_YgpS5Br4HVerevDUPDePIdahRQvh6kua6GEKCg&s=ZTWdoePYiHrdwy3YThpUs2-mmvop7hGq2ibwteX9CYA&e=

---

Arthur Goldberg
Associate Professor of Psychiatry
Seaver Autism Center and Icahn Institute for Genomics & Multiscale Biology
Icahn School of Medicine at Mount Sinai
Seaver Center, Room ABE-33
212-241-4229
Arthur.Goldberg at mssm.edu<mailto:Arthur.Goldberg at mssm.edu>
Follow us on Twitter @IcahnInstitute<https://twitter.com/IcahnInstitute>




<geneticsDBMScommon.py><geneticsSubjects.py>

---

Arthur Goldberg
Associate Professor of Psychiatry
Seaver Autism Center and Icahn Institute for Genomics & Multiscale Biology
Icahn School of Medicine at Mount Sinai
Seaver Center, Room ABE-33
212-241-4229
Arthur.Goldberg at mssm.edu<mailto:Arthur.Goldberg at mssm.edu>
Follow us on Twitter @IcahnInstitute<https://twitter.com/IcahnInstitute>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20141105/ab09ab0a/attachment.html>


More information about the ponyorm-list mailing list