I have a legacy database that I am working with where there are
multiple tables that have the same structure. Because of the shear
number of tables and the fact that new tables are created daily, it's
not possible to have definitions for each table. So we came up with a
system where we have one parent table definition in code that is then
used to clone tables based on an http request that defines which
tablename we need. The method we use for clone is below.

def clone_table(table, name, metadata = None):
    if not metadata:
        metadata = table.metadata
    try:
        return metadata.tables[name]
    except KeyError:
        args = []
        kwargs = {}
        args.append(name)
        args.append(metadata)
        for c in table.columns:
            args.append(c.copy())
        for c in table.constraints:
            args.append(c.copy())
        return Table(*args)

The problem we are running up against is coming about because we are
trying to upgrade from 0.5.0 to 0.5.7. Everything has been working
fine until the upgrade. On certain tables that have sequences we are
getting, (ProgrammingError) can't adapt, on insert.

one thing that we noticed is that we are seeing the Sequence
definition in our params for the insert, like so:
'campaign_id': Sequence('campaign_seq', start=None, increment=None,
optional=False)

Any ideas would be helpful
-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to