foreign keys should be reflected (if thats what youre asking).  if  
you have a mysql table thats not reflecting properly, feel free to  
send its DDL on over.

if you want a column to be a foreign key to several other tables,  
youre better off appending ForeignKeyConstraint objects to the end of  
your Table definition.

On Sep 20, 2006, at 11:13 PM, Daniel Holth wrote:

> Today I had the following solution against SQLAlchemy's trunk while
> dealing with a MySQL database. This MySQL 4.0 database has the gall to
> have upper case letters in its table names, and it returns the
> lower_case_table_names variable as the string '0'.
>
> No foreign key relationships were ever specified in the db either. Do
> I really have to append the Foreign Key attribute all the time? How do
> I deal with a column that's a foreign key to several other tables,
> where several kinds of Items all need to have a Product property?
>
> Thanks,
>
> Daniel Holth
>
> Index: lib/sqlalchemy/databases/mysql.py
> ===================================================================
> --- lib/sqlalchemy/databases/mysql.py   (revision 1873)
> +++ lib/sqlalchemy/databases/mysql.py   (working copy)
> @@ -313,7 +313,7 @@
>
>      def reflecttable(self, connection, table):
>          # reference:
> http://dev.mysql.com/doc/refman/5.0/en/name-case-sensitivity.html
> -        case_sensitive = connection.execute("show variables like
> 'lower_case_table_names'").fetchone()[1] == 0
> +        case_sensitive = int(connection.execute("show variables like
> 'lower_case_table_names'").fetchone()[1]) == 0
>          if not case_sensitive:
>              table.name = table.name.lower()
>              table.metadata.tables[table.name]= table
>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys -- and earn  
> cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to