You can place triggers in your class definitions, there are decorators for
this,
see @afterUpdate, @beforeUpdate, @afterDelete, @beforeDelete, @afterInsert,
@beforeInsert. You can search for these in the documentation, I am not sure of
the exact spelling tho.
Cheers,
Y.chaouche
-
I have the following:
objs =
MyTable.query.options(defer(Table.potentially_very_long_str_column)).all()
for obj in objs:
obj.potentially_very_long_str_column = ''
At the moment, I'm seeing the assignment in the loop issue the `SELECT
potentially_very_long_str_column`, even
is this a mutable type like PickleType? the previous value should not be
loaded otherwise (assuming at least a recent 0.5 or 0.6 version). If so, the
mutability flag should be disabled.
On Nov 4, 2010, at 7:05 AM, Eoghan Murray wrote:
I have the following:
objs =
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
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
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
I have a transaction started with begin
I then delete a record in the transaction.
I then commit and the commit fails.
I now want to continue by undelete the record but leave
record in the session.
I want to leave the record in the session because session
is doing caching.
The session is
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
On Nov 4, 2010, at 4:38 PM, Mike Bernson wrote:
I have a transaction started with begin
I then delete a record in the transaction.
I then commit and the commit fails.
I now want to continue by undelete the record but leave
record in the session.
I want to leave the record in the session
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
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,
I am trying to run this query:
CREATE TABLE dependenciesbinary (
id INTEGER NOT NULL AUTO_INCREMENT,
dependency_mn VARCHAR(128),
name VARCHAR(128),
operatingsystem VARCHAR(128),
architecture VARCHAR(128),
PRIMARY KEY (id),
FOREIGN KEY(dependency_mn) REFERENCES
I am getting a StaleDataError when updating a Float column to the same value
twice in a row. This happens because SQLAlchemy thinks that I am changing
the value, but then the DB reports that no value was changed.
Test case can be seen here: http://pastebin.com/vxFBAMxm
Is there an easy way
Strictly that's not a query, it's a table definition. Do you mean that
you are creating a declarative model class corresponding to this table
definition? Posting your code would help more.
You must define both tables on the same metadata instance (in
declarative, that's typically done by having
On Nov 4, 2010, at 8:17 PM, Lenza McElrath wrote:
I am getting a StaleDataError when updating a Float column to the same value
twice in a row. This happens because SQLAlchemy thinks that I am changing
the value, but then the DB reports that no value was changed.
Test case can be seen
Interesting. When I use your simple engine I do not get the error either,
but I definitely get it when using my real configuration. We are using a
connection pool. So the construction of the session maker for the test
looks like this:
e = sqlalchemy.create_engine('mysql://',
16 matches
Mail list logo