[sqlalchemy] PostgreSQL - fetching boolean type gives integer type

2006-12-21 Thread Sanjay
In PostgreSQL, this code: {{{ # select a row from website_type_tbl(wtype_id INTEGER PK, show_ads BOOLEAN) row = website_type_tbl.select().execute().fetchone() # insert another row website_type_tbl.insert().execute(wtype_id=5, show_ads=row.show_ads) }}} Produces error - SQLError:

[sqlalchemy] Re: MySQL Functions

2006-12-21 Thread saxon75
It must be something stupid on my end, then. I'm sure I'll smack myself when I figure it out. Thanks for your help. On Dec 20, 6:24 pm, Michael Bayer [EMAIL PROTECTED] wrote: i just tried out your example and it executes fine using mysql 5, query output is: SELECT blog_articles.timestamp AS

[sqlalchemy] Re: PostgreSQL - fetching boolean type gives integer type

2006-12-21 Thread Alan Franzoni
Remember this is not a wiki! {{{}}} won't format the code as you might expect. BTW, everything ok here on pgsql; boolean are True or False. You should try posting at least your db metadata and tell us which version of pgsql and psycopg you're using. -- Alan Franzoni [EMAIL PROTECTED] - Togli

[sqlalchemy] Re: problem with backref

2006-12-21 Thread Manlio Perillo
Michael Bayer ha scritto: the original mapping essentially expressed this relationship: A -- cascade=all, delete-orphan -- B in both directions. What that means is, there cannot be an A with no B in the database, and there cannot be a B with no A in the database, i.e. its either A-B or

[sqlalchemy] Re: problem with backref

2006-12-21 Thread Manlio Perillo
Alan Franzoni ha scritto: The problem is that it requires the explicit use of the session. In my case this means that I can not delete the object inside a method of my class. class A(object): def enableB(enable=True): if enable: self.b = B(...)

[sqlalchemy] Re: problem with backref

2006-12-21 Thread Alan Franzoni
A better solution is to do sess = object_session(self) That's wonderful and I didn't know about it! Finally I'll give up passing session around my code! Thanks! -- Alan Franzoni [EMAIL PROTECTED] - Togli .xyz dalla mia email per contattarmi. Remove .xyz from my address in order to contact

[sqlalchemy] Partial Metadata Divination?

2006-12-21 Thread [EMAIL PROTECTED]
I'm just learning to use SQLAlchemy and loving the way it can figure out the columns for a simple table. Now, if I need relations, do I need to specify all tables? (Or can I get away with only specifying he relation?) Thanks, A. --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: PostgreSQL - fetching boolean type gives integer type

2006-12-21 Thread Michael Bayer
thats true the PG boolean type is not currently performing any translation on the value, meaning the 0 and 1 is what psycopg2 is giving you. however, the value should be able to go right back in if thats what its giving you, else psycopg2 is not consistent with itself. anyway as a workaround

[sqlalchemy] Re: Partial Metadata Divination?

2006-12-21 Thread Michael Bayer
if you reflect a table that has a foreign key reference on itself to another table, that other table will be reflected as well, but at that point the second Table object is sitting inside the MetaData instance. to use it in a relation still requires that the related class is mapped, which

[sqlalchemy] Re: PostgreSQL - fetching boolean type gives integer type

2006-12-21 Thread Alan Franzoni
thats true the PG boolean type is not currently performing any translation on the value, meaning the 0 and 1 is what psycopg2 is giving you. however, the value should be able to go right back in if thats what its giving you, else psycopg2 is not consistent with itself. ? which version of

[sqlalchemy] Re: PostgreSQL - fetching boolean type gives integer type

2006-12-21 Thread Michael Bayer
in sanjay's example, its inserting an integer 1 or 0 value, not True. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To

[sqlalchemy] Re: How to auto-set timestamp: MySQL func.now(), but not SQLite

2006-12-21 Thread Michael Bayer
func.current_timestamp() (which evaulates without the parenthesis in SQL) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To