schema name not used in references to sequences (postgresql)

Issue #88 resolved
Former user created an issue

The following code attempts to insert a row into a table which is NOT in the 'public' schema.

An exception is raised indicating that the primary key sequence does not exist. It appears that the sequence is being referenced without the schema name.

from sqlalchemy import *

engine = create_engine('postgres', {'database':'james'})

test_table = Table('my_table', engine,
                Column('id', Integer, primary_key=True),
                Column('data', String(20), nullable=False),
                schema='my_schema'
             )

class Test(object):
    pass

Test.mapper = mapper(Test, test_table)
obj = Test()
obj.data = 'the data'
objectstore.commit()

The exception raised is:

SQLError: (ProgrammingError) relation "my_table_id_seq" does not exist

I believe {{{my_table_id_seq}}} should be the 'qualified' name: {{{my_schema.my_table_id_seq}}}.

Comments (1)

  1. Log in to comment