[sqlalchemy] how to update two fieds from two tables where one depends on the other simultaneously

2013-12-03 Thread Chung WONG
Hi all, Say there are two tables defined as below: class Topic(Base): __tablename__ = 'topics' id = Column(Integer,Sequence('topic_id_seq'), primary_key=True) *last_posted_at=Column(DateTime,default=func.now())* created_at=Column(DateTime,default=func.now())

[sqlalchemy] ProgrammingError: cannot determine type of empty array even with proper model declaration?

2013-12-03 Thread Michael Nachtigal
Hello, all, I'm receiving this error: ProgrammingError: (ProgrammingError) cannot determine type of empty array It looks like this is happening because the default value for column in new instances of one of my models is being initialized to [] (an empty array, no inner type), despite my

Re: [sqlalchemy] ProgrammingError: cannot determine type of empty array even with proper model declaration?

2013-12-03 Thread Gunnlaugur Thor Briem
Hi, 1. the server_default=... argument just says what default to define for the column *on creation* --- it has no effect if the table already exists. To apply the default to an existing table, you need to execute something like: ALTER TABLE mytbl ALTER COLUMN mycol ADD DEFAULT

RE: [sqlalchemy] ProgrammingError: cannot determine type of empty array even with proper model declaration?

2013-12-03 Thread Michael Nachtigal
Gulli, Thank you so much for the helpful information. I think that the type_ argument should cause an explicit cast if it's on a default array empty list value; that very much was my expectation, unfortunately! I've discovered what appears to be very strange unexpected behavior: mycol =

Re: [sqlalchemy] ProgrammingError: cannot determine type of empty array even with proper model declaration?

2013-12-03 Thread Michael Bayer
it seems like psycopg2 is doing some odd pattern of guessing vs. not here, if default=[] works and default=array([]) does not, not sure why that would be, examining the SQL output (if not the PG logs themselves with statement logging turned on to see what psycopg2 is actually sending) would

Re: [sqlalchemy] how to update two fieds from two tables where one depends on the other simultaneously

2013-12-03 Thread Michael Bayer
On Dec 3, 2013, at 5:40 AM, Chung WONG wch...@gmail.com wrote: Hi all, Say there are two tables defined as below: class Topic(Base): __tablename__ = 'topics' id = Column(Integer,Sequence('topic_id_seq'), primary_key=True) last_posted_at=Column(DateTime,default=func.now())

Re: [sqlalchemy] pyodbc.connect works create_engine fails

2013-12-03 Thread Karthic Raghupathi
Thank you so much for this snippet! It helped figure out my connectivity issues to Microsoft SQL Server. On Thursday, December 23, 2010 1:42:42 PM UTC-5, Michael Bayer wrote: On Dec 23, 2010, at 1:31 PM, Pirate Fibonacci wrote: running on fedora 13. yum installed everything. got unixodbc