On 6 Feb 2006, at 01:39, Michael Bayer wrote:

On Feb 5, 2006, at 8:14 PM, Alastair Houghton wrote:

1. What it's supposed to do if there is more than one column listed in the PRIMARY KEY. Currently it adds them to the table's list of primary keys directly... is this right?


well you dont have to add them to the primary_key list, that happens automatically for you when you create a Column with primary_key=True and append it to the table. If theres multiple primary key columns, they just go in like that.

Ah, OK. Makes sense (I'd probably have realised that if I'd thought about it a bit more :-))

2. What to do about cases that SQLAlchemy doesn't seem to support (e.g. constraints, foreign keys with more than one column).

well, there are tickets to support some new things, like indexes and uniques, so someday that will get added. at the moment they just get ignored. a foreign key with more than one column...I have not seen that before (at least not in years....hence its not in the code!) ! That is also something ForeignKey should be made to support, i.e. instead of having "column" it would have "columns", and then some other things would have to change, noteably "_match_primaries" in sqlalchemy.sql.Join. not too big a deal except for fixing table reflection to pull them in.

At the moment Wade's patch seems to do the job for what we have so far....since its shorter and simpler im inclined to keep it in for now, even though it doesnt do our "grab it all from the SHOW CREATE TABLE" idea that you have achieved here. If we add more schema constructs as noted above, might need to enhance some more. but thanks for the effort and advice , I am psyched to finally have MySQL doing this !

Yes, I thought you'd probably say that :-). Since I'm still learning my way around Python, it was a good exercise trying to write it so I'm still pleased I did it.

One thing I did wonder was whether the other databases all support something like SHOW CREATE TABLE; if they did, then, after a bit of generalisation, you could just have a single implementation of the parsing code, which would make things more manageable.

Kind regards,

Alastair.

--
http://www.alastairs-place.net




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to