MCPcopy Create free account
hub / github.com/apache/impala / test_postgres_table_reading

Function test_postgres_table_reading

tests/comparison/tests/test_cursor.py:172–184  ·  view source on GitHub ↗

Test that when a postgres table is read by the Postgresql cursor, the Table object contains the correct primary keys. This tests interacts with the local PostgreSQL database that's part of the minicluster.

(postgresql_cursor, sql_primary_key_map)

Source from the content-addressed store, hash-verified

170 'primary_keys': ('col1', 'col2', 'col3')}
171 ])
172def test_postgres_table_reading(postgresql_cursor, sql_primary_key_map):
173 """
174 Test that when a postgres table is read by the Postgresql cursor, the Table object
175 contains the correct primary keys. This tests interacts with the local PostgreSQL
176 database that's part of the minicluster.
177 """
178 try:
179 postgresql_cursor.execute('DROP TABLE IF EXISTS mytable')
180 postgresql_cursor.execute(sql_primary_key_map['sql'])
181 table = postgresql_cursor.describe_table('mytable')
182 assert table.primary_key_names == sql_primary_key_map['primary_keys']
183 finally:
184 postgresql_cursor.execute('DROP TABLE mytable')

Callers

nothing calls this directly

Calls 2

executeMethod · 0.45
describe_tableMethod · 0.45

Tested by

no test coverage detected