On Feb 12, 3:49 pm, "Michael Bayer" <[EMAIL PROTECTED]> wrote:
> drop_all() doesnt remove Table instances from the metadata.  the Table
> object is a python object, it only represents your real database
> table.  you may well want to call create_all() again using that same
> Table.
>
> On Feb 12, 3:20 pm, "percious" <[EMAIL PROTECTED]> wrote:
>
> > See test case:
>
> > from turbogears import config
> > from turbogears.database import metadata
> > from turbogears import database
>
> > from sqlalchemy import Table, Column, Integer, Unicode
> > import sqlalchemy.orm
>
> > config.update({"sqlalchemy.dburi":"sqlite:///:memory:"})
> > database.bind_meta_data()
>
> > Table('t_table', metadata,
> >   Column('id', Integer, primary_key=True),
> >   Column('data', Unicode(255)),
> >   ).create()
>
> > Table('t_table_history', metadata,
> >   Column('id', Integer, primary_key=True),
> >   Column('data', Unicode(255)),
> >   ).create()
>
> > assert  metadata.tables.keys() == ['t_table', 't_table_history']
>
> > metadata.drop_all(tables=['t_table_history',])
>
> > #fails
> > assert  metadata.tables.keys() == ['t_table']

Would it make sense to add the following code to line 905 in your
schema.py???
        if tables is None:
            self.tables.clear()
        else:
            for table in tables:
                if type(table) is str:
                    del self.tables[table]
                else:
                    for k, t in self.tables.iteritems():
                        if t is table:
                            del self.tables[k]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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