Re: [sqlalchemy] Re: can someone tell me how to reset Alembic back to the state of my DB

2014-12-31 Thread dewey
Excellent!! Thank you. D On Tuesday, December 30, 2014 8:47:38 PM UTC-6, Ams Fwd wrote: Blow away the alembic versions table from the database and the folder with the versions file and patches files on disk and you should be good to go. HTH AM On 12/30/2014 06:01 PM, dewey wrote:

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread dewey
I've added a naming convention to my metadata object (using declarative): customMetadata = MetaData(naming_convention=constraintNameConv) # schema='pay' Base = declarative_base(cls=DbBase, metadata=customMetadata, constructor=record_constructor) and now I'm getting this error when I try to

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread Michael Bayer
what kind of constraint has that problem, keep in mind there’s primary key constraints, there’s a UNIQUE constraint if you say unique=True, etc. need more info dewey de...@pathoz.com wrote: I've added a naming convention to my metadata object (using declarative): customMetadata =

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread dewey
Thanks very much for the response and I'm not sure how to answer that. Apart from my entry point: Base.metadata.create_all(engine) the stack trace only references SA code. so I don't know which constraint is causing the problem I have about 10 tables with a large mix of PKEY, FKEY, index,

[sqlalchemy] Using use_alter=True when doing a table.metadata.create_all()

2014-12-31 Thread Mike Arbelaez
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] loop over two large tables to join them

2014-12-31 Thread Mehdi
Hi What would be the most efficient way to loop over a large table(12 rows) and base on some conditions find the match on another table(7 rows)? Actually i'm working on a given db which there are TableA with 14 fields and more than 12 rows and TableB with 150 fields and about 7

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread Michael Bayer
well seeing the actual naming convention would help…. :) it looks like a CHECK constraint. dewey de...@pathoz.com wrote: Thanks very much for the response and I'm not sure how to answer that. Apart from my entry point: Base.metadata.create_all(engine) the stack trace only references SA

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread dewey
I've checked and I don't have an EXPLICIT check constraints but I understand thats not definitive. Here is the pattern: @event.listens_for(Column, before_parent_attach) def attach(target, tableObj): if tableObj.metadata is Base.metadata: target.name = %s%s % (tableObj.name[0:4],

Re: [sqlalchemy] Using use_alter=True when doing a table.metadata.create_all()

2014-12-31 Thread Michael Bayer
best way is probably to add it on after the fact. this is the flag but also because the flag isn’t set up front, seems to need the add/drop directives to be applied as in http://docs.sqlalchemy.org/en/rel_0_9/core/ddl.html#controlling-ddl-sequences: from sqlalchemy.schema import AddConstraint,

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread Michael Bayer
dewey de...@pathoz.com wrote: I've checked and I don't have an EXPLICIT check constraints but I understand thats not definitive. OK sometimes these come out for boolean or ENUM fields. For Booleans I’d probably turn off this constraint, set create_constraint=False:

Re: [sqlalchemy] Using use_alter=True when doing a table.metadata.create_all()

2014-12-31 Thread Michael Bayer
best way is probably to add it on after the fact. this is the flag but also because the flag isn’t set up front, seems to need the add/drop directives to be applied as in http://docs.sqlalchemy.org/en/rel_0_9/core/ddl.html#controlling-ddl-sequences: from sqlalchemy.schema import AddConstraint,

Re: [sqlalchemy] automated column naming in the actual DB table

2014-12-31 Thread dewey
Sorry...change which constraint naming pattern? I'm not tracking what the problem is so following your directions to fix it has me a bit lost. What I think you are saying is that SQL alchemy is creating a check(0,1) constraint for my boolean fields on the mysql server And that something