Re: [sqlalchemy] Re: Creating tables in correct order

2019-11-13 Thread Simon King
SQLAlchemy will create tables in the correct order as long as you have told it about the dependencies (using the ForeignKey construct). If this isn't working for you, could you show us your code? Simon On Wed, Nov 13, 2019 at 7:17 AM Andrew Bogaard wrote: > > Richie, I realize this thread is lon

[sqlalchemy] Re: Creating tables in correct order

2019-11-12 Thread Andrew Bogaard
Richie, I realize this thread is long long dead, but do you have any recollection of how you fixed this? Thanks, Andrew On Thursday, November 4, 2010 at 3:51:00 PM UTC-7, Richie Ward wrote: > > I am trying to run this query: > CREATE TABLE dependenciesbinary ( > id INTEGER NOT NULL AUTO_IN

[sqlalchemy] Re: Creating tables in correct order

2010-11-08 Thread Gunnlaugur Briem
Hi, that example code works for me in PostgreSQL, after adding unique=True on the name attribute of User, and reversing the order of the drop calls. I don't have a MySQL to try against. Did you get the exact same error from it when running against MySQL? As for your actual app: 1. the log output

[sqlalchemy] Re: Creating tables in correct order

2010-11-05 Thread Richie Ward
I have put my problem in a small program for easy understanding. Run this with MySQL. from sqlalchemy import create_engine, __version__ from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sess

[sqlalchemy] Re: Creating tables in correct order

2010-11-05 Thread Richie Ward
I think I am using the same declarative_base instance but it is still making the tables in the wrong order. My model is at: http://bazaar.launchpad.net/~richies/hypernucleus-server/PylonsPortExperimental/files/head%3A/hypernucleusserver/model/ And here is what happens when I run: paster setup-app

[sqlalchemy] Re: Creating tables in correct order

2010-11-04 Thread Gunnlaugur Briem
Strictly that's not a query, it's a table definition. Do you mean that you are creating a declarative model class corresponding to this table definition? Posting your code would help more. You must define both tables on the same metadata instance (in declarative, that's typically done by having bo