You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step1:Create an instance with table_name bieng a view in database
Table(table_name, meta,schema=schema or None,
autoload=True,autoload_with=self.get_sqla_engine())
Above statement makes a call to Table class located in sqlalchemy.sql.schema module
Step2: Since autoload = True, this will try to load the column definitions and makes call to
engine.run_callable() method with callabale as reflecttable method in corresponding dialect class (in this example in DefaultDialect). This will create an inspector instance binding the current sqlalchemy engine and make a reflecttable call on inspector instance.
Step3: reflecttable call is routed to a method of Inspector class in sqlalchemy.engine.reflection module. This method makes various call to get columns, constrainsts such as primarykey,foreignkey,uniquekey and CheckConstraints.
Issue: During call to dialects get_check_constraints() with a view name, inside get_check_constraints
self.get_table_oid() method is called which just checks only for table. In case of view it raises NoSuchTableError()
Possible Resolution:
1.Do not make call to get_table_oid() method
2.Change the Query to check on schemaname and tablename instead of objectid (Same as in other constraint methods)
SELECT constraint_name, column_name
FROM v_catalog.constraint_columns
WHERE lower(table_schema) = '%(schema)s'
AND lower(table_name) = '%(table)s'
AND constraint_type = 'c'
The text was updated successfully, but these errors were encountered:
Step1:Create an instance with table_name bieng a view in database
Table(table_name, meta,schema=schema or None,
autoload=True,autoload_with=self.get_sqla_engine())
Above statement makes a call to Table class located in sqlalchemy.sql.schema module
Step2: Since autoload = True, this will try to load the column definitions and makes call to
engine.run_callable() method with callabale as reflecttable method in corresponding dialect class (in this example in DefaultDialect). This will create an inspector instance binding the current sqlalchemy engine and make a reflecttable call on inspector instance.
Step3: reflecttable call is routed to a method of Inspector class in sqlalchemy.engine.reflection module. This method makes various call to get columns, constrainsts such as primarykey,foreignkey,uniquekey and CheckConstraints.
Issue: During call to dialects get_check_constraints() with a view name, inside get_check_constraints
self.get_table_oid() method is called which just checks only for table. In case of view it raises NoSuchTableError()
Possible Resolution:
1.Do not make call to get_table_oid() method
2.Change the Query to check on schemaname and tablename instead of objectid (Same as in other constraint methods)
SELECT constraint_name, column_name
FROM v_catalog.constraint_columns
WHERE lower(table_schema) = '%(schema)s'
AND lower(table_name) = '%(table)s'
AND constraint_type = 'c'
The text was updated successfully, but these errors were encountered: