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
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
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
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
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
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