kvesteri / sqlalchemy-continuum

Versioning extension for SQLAlchemy.
BSD 3-Clause "New" or "Revised" License
575 stars 127 forks source link

Teradata Transaction table's ID column is not auto generated #256

Open Amr-Hash opened 3 years ago

Amr-Hash commented 3 years ago

Teradata ID field is generated as BIGINT only and it's not auto incremented, There is a column called Identity Column in teradata But to fix it I think you could add an optional UUID or using the timestamp as the Primary Key instead of the ID.

AbdealiLoKo commented 2 years ago

There is already a sequence added in the Transaction.id table - does that work with teradata Could you provide a reproducible example ?

I will also mention that you can provide your own Transaction model in the make_versioned:

from sqlalchemy_continuum import VersioningManager, make_versioned
from sqlalchemy_continuum.transaction import TransactionBase

class MyTransaction(Base, TransactionBase): # Where Base is the sqla declarative base
    # Here you can add any custom attributes for ID you need for your DB
    id = sa.Column(sa.types.BigInteger, sa.schema.Sequence('transaction_id_seq'), primary_key=True, autoincrement=True)

make_versioned(
    versioning_manager=VersioningManager(transaction_cls=MyTransaction)
)