Re: [sqlalchemy] Weird error with update

2009-11-23 Thread Mike Conley
> Why not use update({ESMagicNumber.last_access: datetime.datetime.now()}) ? > > > one advantage of this syntax is that Python will raise an exception that last_access does not exist. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this

Re: [sqlalchemy] Warning: Can't create database 'TEST'; database exists

2009-11-23 Thread Conor
Peter wrote: > Hi > I do: > > engine = create_engine('mysql://r...@localhost/tmp) > Session = sessionmaker() > Session.configure(bind=engine) > connection = engine.connect() > session = Session() > > # suppose database TEST exists > connection.execute('CREATE DATABASE IF NOT EXISTS TEST') > > Why d

[sqlalchemy] Warning: Can't create database 'TEST'; database exists

2009-11-23 Thread Peter
Hi I do: engine = create_engine('mysql://r...@localhost/tmp) Session = sessionmaker() Session.configure(bind=engine) connection = engine.connect() session = Session() # suppose database TEST exists connection.execute('CREATE DATABASE IF NOT EXISTS TEST') Why does this gives a warning : /usr/lib

Re: [sqlalchemy] Re: String to Column Type Conversion

2009-11-23 Thread Thomas Burdick
This is exactly what I was looking for, thank you. Tom On Nov 23, 2009 12:42 PM, "Conor" wrote: Tom Burdick wrote: > Ok, here's a small test. It actually works fine when using sqlite, but > not wh... You can use sqlalchemy.cast() to coerce the type on the DB side: coerced_teststr = cast(teststr

Re: [sqlalchemy] Re: String to Column Type Conversion

2009-11-23 Thread Conor
Tom Burdick wrote: > Ok, here's a small test. It actually works fine when using sqlite, but > not when using postgresql. I want it to work with postgresql! > > This probably helps more than the description above. > > http://www.pylonshq.com/pasties/fe6a2857f3f72d499914caabce0d41bc > > -Tom > > On N

[sqlalchemy] Re: String to Column Type Conversion

2009-11-23 Thread Tom Burdick
Ok, here's a small test. It actually works fine when using sqlite, but not when using postgresql. I want it to work with postgresql! This probably helps more than the description above. http://www.pylonshq.com/pasties/fe6a2857f3f72d499914caabce0d41bc -Tom On Nov 23, 10:33 am, Tom Burdick wrote

[sqlalchemy] String to Column Type Conversion

2009-11-23 Thread Tom Burdick
I would like to present my users a simple search box that searches a table. I have issues getting DataError when using the text input and trying to do filter against a column that is an integer only column. I want to have some code that takes a particular sqlalchemy column object and attempts to

Re: [sqlalchemy] get_or_create(**kwargs) ?

2009-11-23 Thread Conor
chaouche yacine wrote: > --- On Sun, 11/22/09, Conor wrote: > > >> There is a problem with your code when the tag is in the >> cache: if the >> tag is added to the session via session.add or a relation >> "add" cascade, >> SQLAlchemy will try to INSERT the tag into the database on >> the next >

Re: [sqlalchemy] get_or_create(**kwargs) ?

2009-11-23 Thread chaouche yacine
--- On Sun, 11/22/09, Conor wrote: > There is a problem with your code when the tag is in the > cache: if the > tag is added to the session via session.add or a relation > "add" cascade, > SQLAlchemy will try to INSERT the tag into the database on > the next > flush. > -Conor I don't know, it