I'm currently reflecting a few tables from a MSSQL database and then 
creating the table structure over to Postgres. I'm using sqlalchemy 0.9 and 
python 2.7.

So far I've been very successful doing this with most of the tables except 
on a few tables I've received a 'sqlalchemy.exc.CircularDependencyError: 
Circular dependency detected.'

I've done some research and it looks like I'll need to do a 
'use_alter=True', however, I'm not defining any or foreign keys those are 
being picked up by the reflection process.

How would I add this parameter to my 'create_all()' statement. I've 
included the basic logic below.


def make_session(connection_string):
    engine = create_engine(connection_string, echo=True, convert_unicode=True)
    Session = sessionmaker(bind=engine)
    return Session(), engine



sengine = 'mssql+pyodbc://User:Password@sourcedb'
dengine = 'mssql+pyodbc://User:Password@destinationdb'


source, engine = make_session(sengine)
smeta = MetaData(bind=sengine)


destination, dengine = make_session(dengine)


table_name = 'SomeTable'


#Load the table
table = Table(table_name, smeta, autoload=True)

#Create table at new destination
table.metadata.create_all(dengine)




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to