On 4/15/15 10:38 PM, Khoa Nguyen Minh wrote:
Hi everyone,

Could you please tell me whether SQLAlchemy 0.8.2 supports NULL value when using version_id_col? Currently, the correspond SQL emitted when updating/deleting is:

*where [version_column] = NULL*
*
*
That always raises StaleDataError exception. Is there a way we can emit custom SQL so that when the original value is NULL then the emitted SQL will be:

*where [version_column] is NULL*

NULL can't be supported because the value used for version_id is embedded into a fixed UPDATE statement using a bound parameter. There is no opportunity to produce an alternate UPDATE statement that doesn't use the parameter and encodes "IS NULL". The same statement can be passed to the DBAPI with a list of parameter sets.



and in normal case, the emitted SQL will be:

*where [version_column] = [value]*

Also, I think that if SQLAlchemy provides the custom version_id_generator then why it doesn't support *custom version_id_col where clause when updating/editing*?
versioning schemes typically only vary in the kinds of values they persist, e.g. integer counters, timestamps, GUIDs, etc. It's not really necessary for a versioning scheme to support NULL; a NULL version doesn't make any sense because it means that a record has an unknown version.



Really appreciate your helps,

Khoa Minh Nguyen
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com <mailto:sqlalchemy+unsubscr...@googlegroups.com>. To post to this group, send email to sqlalchemy@googlegroups.com <mailto:sqlalchemy@googlegroups.com>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to