from sqlalchemy import *
from sqlalchemy.types import UserDefinedType


class GUID(UserDefinedType):
    def get_col_spec(self, **kw):
        return "GUID"

e = create_engine("sqlite://", echo=True)

m = MetaData()
t = Table(
    't', m,
    Column('id', GUID),
    PrimaryKeyConstraint('id', name="PkReference")
)
m.create_all(e)



output:

CREATE TABLE t (
        id GUID NOT NULL,
        CONSTRAINT "PkReference" PRIMARY KEY (id)
)



On 03/09/2016 07:11 PM, [email protected] wrote:
What would be the best and most save way to represent the "GUID PRIMARY
KEY" column type from SQLite3 in a SQLAlchemy schema?

The SQL looks like this

CREATE TABLE Reference (ID GUID CONSTRAINT PK_Reference PRIMARY KEY, ...

The DB ist foreign and not created by me.


--
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