On Jan 23, 2012, at 6:45 PM, Michael Bayer wrote:
>
> On Jan 23, 2012, at 8:25 AM, Robert Forkel wrote:
>
>> hi,
>> just ran into the following problem: When creating tables (for oracle)
>> with a primary key fetched from a sequence, the create statement for
>> the sequence is issued twice; i.e. the following code
>>
>> from sqlalchemy import MetaData, create_engine, Table, Column,
>> Integer, Sequence
>> from sqlalchemy.schema import DDL
>>
>> def dump(sql, *multiparams, **params):
>> print sql.compile(dialect=engine.dialect)
>> engine = create_engine('oracle://', strategy='mock', executor=dump)
>>
>> metadata = MetaData()
>> metadata.bind = engine
>>
>> t = Table('testtable', metadata,
>> Column('pk', Integer, Sequence('testtable_pk_seq',
>> schema='schemaname'), primary_key=True),
>> schema='schemaname'
>> )
>> t.create()
>
> this is a fairly serious issue captured in
> http://www.sqlalchemy.org/trac/ticket/2384 , for now a workaround is to say:
>
> metadata.create_all(tables=[t])
Actually it's local to the "mock" strategy, so the fix is pretty quick, there's
a patch on that ticket now but I need to write some tests.
--
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.