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 <aboga...@gmail.com> wrote:
>
> 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_INCREMENT,
>>     dependency_mn VARCHAR(128),
>>     name VARCHAR(128),
>>     operatingsystem VARCHAR(128),
>>     architecture VARCHAR(128),
>>     PRIMARY KEY (id),
>>     FOREIGN KEY(dependency_mn) REFERENCES dependencies (modulename)
>> )ENGINE=InnoDB CHARSET=utf8
>>
>> But create_all() is not creating the table "dependencies" before
>> "dependenciesbinary" which causes MySQL to error due to the missing
>> table.
>>
>> Is there some way I can change the order of the create statements to
>> fix this?
>>
>> I am using Declarative if that helps.
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> ---
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/b4cc20b6-2468-4b30-9835-27be53c00f07%40googlegroups.com.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAFHwexdao4vDDRaGF95kdnN9AdgnKN%2BjuuP%3D3whWO4xZfF08hw%40mail.gmail.com.

Reply via email to