[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-24 Thread Werner F. Bruhin
Adrian von Bidder wrote: On Friday 22 May 2009 23.00:05 Werner F. Bruhin wrote: What do you want to do with the autoincrement column? Often these are used for primary keys, which in turn get used as foreign keys. I want to use the id as filename; the table will cache some info

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-24 Thread Alexandre Conrad
Hello Adrian, In my case, I actually build up my SA model, flush it, and save the file on disk using the id that's been populated on my object after flush. Sorry, your original question didn't really give enough details on what you wanted to do. What you were trying to achieve is not common

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-23 Thread Adrian von Bidder
On Friday 22 May 2009 23.00:05 Werner F. Bruhin wrote: What do you want to do with the autoincrement column? Often these are used for primary keys, which in turn get used as foreign keys. I want to use the id as filename; the table will cache some info that comes from the file. Using it as a

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-23 Thread Michael Bayer
if its of any value, databases like MySQL and SQLIte do not give you any way to get at an auto-generated ID without actually INSERTing a row. Only databases that support sequences, i.e. postgres, firebird, and oracle, give you a built in way to get IDs without using INSERT. On May 23,

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-22 Thread Alexandre Conrad
Don't you want that non-null column to be a foreign key ? 2009/5/21 Adrian von Bidder avbid...@fortytwo.ch: Hi, Is it possible to fetch the values of an autoincrement field without flushing the object to the DB? (In postgres, I obviously can manually fetch nextval of the automatically

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-22 Thread Adrian von Bidder
On Friday 22 May 2009 08.43:09 Alexandre Conrad wrote: Don't you want that non-null column to be a foreign key ? Would that make a difference? cheers -- vbi 2009/5/21 Adrian von Bidder avbid...@fortytwo.ch: Hi, Is it possible to fetch the values of an autoincrement field without

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-22 Thread Werner F. Bruhin
Adrian, Adrian von Bidder wrote: Hi, Is it possible to fetch the values of an autoincrement field without flushing the object to the DB? (In postgres, I obviously can manually fetch nextval of the automatically generated sequence, but I lose the portability that way ...) Why?

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-22 Thread Alexandre Conrad
Hello Adrian, 2009/5/22 Adrian von Bidder avbid...@fortytwo.ch: On Friday 22 May 2009 08.43:09 Alexandre Conrad wrote: Don't you want that non-null column to be a foreign key ? Would that make a difference? That's what a foreign key is used for: http://en.wikipedia.org/wiki/Foreign_key I

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-22 Thread Adrian von Bidder
On Friday 22 May 2009 13.58:34 Alexandre Conrad wrote: Hello Adrian, 2009/5/22 Adrian von Bidder avbid...@fortytwo.ch: On Friday 22 May 2009 08.43:09 Alexandre Conrad wrote: Don't you want that non-null column to be a foreign key ? Would that make a difference? That's what a foreign

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-22 Thread Alexandre Conrad
Could you please send your SQLAlchemy tables you are working with to have a better idea of what's you want to achieve ? 2009/5/22 Adrian von Bidder avbid...@fortytwo.ch: On Friday 22 May 2009 13.58:34 Alexandre Conrad wrote: Hello Adrian, 2009/5/22 Adrian von Bidder avbid...@fortytwo.ch: