im not familiar with what "__metada__" is and this seems to be an  
elixir specific issue.  metadata.drop_all()/create_all() always do  
what they say.


On Jun 19, 2008, at 2:01 PM, lilo wrote:

>
> I have tried this command:
>    a.a_metadata.drop_all(bind=db)
>    a.a_metadata.create_all(bind=db)
>
> and they don't create any tables and I don't get any error at all.
>
> With, setup_all(True, bind=db), creates table A and B on each engine.
> I just want table A on m1,m2 and table B on n1,n2.  I have spent quite
> some time searching and going over the docs but I can't figure out the
> problem is.
>
> =================================================================
> ### file c.py
>
> #!/usr/bin/env python
>
> from sqlalchemy import create_engine
>
> import b
> import a
>
> m1 = create_engine("mysql://m1:[EMAIL PROTECTED]:3306/m1", echo=True)
> m2 = create_engine("mysql://m2:[EMAIL PROTECTED]:3306/m2", echo=True)
>
> n1 = create_engine("mysql://n1:[EMAIL PROTECTED]:3306/n1", echo=True)
> n2 = create_engine("mysql://n2:[EMAIL PROTECTED]:3306/n2", echo=True)
>
> # create tables
> for db in (m1, m2):
>    a.a_metadata.drop_all(bind=db)
>    a.a_metadata.create_all(bind=db)
>
>    #setup_all(True, bind=db)
>
> for db in (n1, n2):
>     # setup_all(True, bind=db)
>    b.b_metadata.drop_all(bind=db)
>    b.b_metadata.create_all(bind=db)
>
> =======================================================
> ### file a.py
>
> from elixir import *
>
> from datetime import datetime
>
> a_metadata = metadata
> __metada__ = a_metadata
>
> class A(Entity):
>    using_options(tablename='a', auto_primarykey = False)
>    aname = Field(String(30),  primary_key = True, nullable = False,
> unique=True)
>
> =========================================================
> ### file b.py
>
> from elixir import *
>
> from datetime import datetime
>
> b_metadata = metadata
> __metada__ = b_metadata
>
> class B(Entity):
>    using_options(tablename='b', auto_primarykey = False)
>    bname = Field(String(30),  primary_key = True, nullable = False,
> unique=True)
>
> >


--~--~---------~--~----~------------~-------~--~----~
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