[sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent
We are writing an application that can run on PostgreSQL or Oracle. Since postgres treats NULL and '' (empty string) differently, while Oracle treats '' as NULL, this can cause subtle behavior differences based on the underlying database. Can you think of a way I could easily intercept all UPDATE

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Michael Bayer
On Nov 4, 2010, at 11:16 AM, Kent wrote: We are writing an application that can run on PostgreSQL or Oracle. Since postgres treats NULL and '' (empty string) differently, while Oracle treats '' as NULL, this can cause subtle behavior differences based on the underlying database. Can you

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent Bower
If I intercept strings that are empty and replace with None, is there potential problems because the database record and the python object are out of sync? Thereafter, will sqla believe the column value has changed and try to write again on next flush()? On 11/4/2010 11:42 AM, Michael

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Michael Bayer
On Nov 4, 2010, at 4:06 PM, Kent Bower wrote: If I intercept strings that are empty and replace with None, is there potential problems because the database record and the python object are out of sync? Thereafter, will sqla believe the column value has changed and try to write again on

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent Bower
Actually, modifying the parameter in cursor_execute() for Postgres behaves exactly as Oracle does now in sqla without and proxy. sqla thinks it is writing an '' to the database, but Oracle is actually changing that to NULL, so it behaves the same. after and update to '', if you ask field is

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent Bower
P.S. Thanks again very much -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options,