SQL Server triggers and sqlalchemy interference problem. Help needed -


i need have kind of 'versioning' critical tables, , tried implement in rather simple way:

create table [dbo].[address] (   [id] bigint identity(1, 1) not null,   [post_code] bigint null, ... )  create table [dbo].[address_history] (   [id] bigint not null,   [id_revision] bigint not null,   [post_code] bigint null, ...   constraint [pk_address_history] primary key clustered ([id], [id_revision]),   constraint [fk_address_history_address]...   constraint [fk_address_history_revision]... )  create table [dbo].[revision] (   [id] bigint identity(1, 1) not null,   [id_revision_operation] bigint null,   [id_document_info] bigint null,   [description] varchar(255) collate cyrillic_general_ci_as null,   [date_revision] datetime null, ... ) 

and bunch of triggers on insert/update/delete each table, intended store it's changes.

my application based on pyqt + sqlalchemy, , when try insert entity, stored in versioned table, sqlalchemy fires error:

the target table 'heritage' of dml statement cannot have  enabled triggers if statement contains  output clause without clause.  (334) (sqlexecdirectw); [42000]  [microsoft][odbc sql server driver] [sql server]statement(s) not prepared. (8180)") 

what should do? must use sqlalchemy. if 1 can give advice me, how can implement versioning without triggers, it'd cool.

you should set 'implicit_returning' 'false' avoid "output" usage in query generated sqlalchemy (and should resolve issue):

class company(sqla.model):     __bind_key__ = 'dbnamere'     __tablename__ = 'tblnamehere'     __table_args__ = {'implicit_returning': false}  # http://docs.sqlalchemy.org/en/latest/dialects/mssql.html#triggers     id = sqla.column('ncompany_id', sqla.integer, primary_key=true)     ... 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -