> That is, in my case, lifetime of objects is much longer that
> lifetime of all database-and-related stuff - and seems this is not
> expected pattern of usage.

more questions on the theme.
What is the expected sequence / lifetime / pattern-of-usage for 
engine, metadata, mappers, and finally, my objects? 
This is also related to multiplicity, e.g. can i have several 
metadatas, and switch between them for same objects.

The only obvious rule i see is that
 a) mappers must be made after metadata; not sure if that being 
unbound is allowed.
The other rule inferred from above problem is
 b) objects lifetime should be shorter than mappers (ORM); else one 
needs to delete o._instance_key and o.db_id to be able to reuse them

Are there other rules? i do remember about doing mappers over unbound 
metadata and binding later did break certain cases.

e.g. default is:
 1.make engine
 2.make metadata + .create_all()
 3.make mappers
 4.objects

can i do:
 1. make metadata /unbound
 2. mappers
 3. make engine
 4. bind metadata + .create_all()
 5. objects
then unbind metadata/drop engine, then repeat 3,4,5 ?

or 
 1. engine
 2. metadata
 3. mappers 
 4. objects
 5 metadata.drop_all() + metadata.create_all()
 6 more objects
 repeat 5,6

or (current links/nodes case)
 1. objects
 2. engine
 3. metadata + createall()
 4. mappers
 5. drop everything
 repeat 2,3,4,5
 ...

or (probably better way of doing it, make type-info stuff once)
 1. engine
 2. metadata + createall()
 3. mappers
 4. objects
 5. metadata.drop_all() + metadata.create_all()
 6. save same objects
 repeat 5,6

svil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to