the documentation is incorrect, please use this form:

    from sqlalchemy import FetchedValue

    class User(Base):
        __tablename__ = 'user'

        id = Column(Integer, primary_key=True)
        name = Column(String(50), nullable=False)
xmin = Column("xmin", Integer, system=True, server_default=FetchedValue())

        __mapper_args__ = {
            'version_id_col': xmin,
            'version_id_generator': False
        }


should be up on the site in 30 minutes.


On 12/12/2016 11:48 AM, Jorge Riquelme wrote:
Hi,

I'm trying to use the xmin column as described
in 
http://docs.sqlalchemy.org/en/latest/orm/versioning.html#server-side-version-counters,
but when I perform an insert I get the following error:

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column
"xmin" of relation "organizations" does not exist
LINE 1: ...INTO organizations (name, created_at, updated_at, xmin) VALU...

It seems that the xmin column should exists, even though it's declared
as a system column (I was expecting the opposite).

The example below reproduces my problem:

https://gist.github.com/jriquelme/985bbf624919dd69591a2b4efe4f0ab4

About my environment:
- Python 3.5.2
- SQLAlchemy 1.1.4
- psycopg2 2.6.2
- Postgres 9.5

Any guidance will be appreciated :)

Best regards

Jorge Riquelme

--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and
Verifiable Example. See http://stackoverflow.com/help/mcve for a full
description.
---
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to