Skip to content

sqlalchemy inspect constraints support #866

Open
@arkeodev

Description

@arkeodev

Upon scrutinizing the schema reflection for Big Query, I am able to discern the dataset lists and glean information about the columns to a certain extent. Although it's not a mandatory requirement, I have the capability to establish primary and foreign keys on tables. However, when I attempt to retrieve this information using an inspector, the following code doesn't yield the expected results:

from sqlalchemy import inspect, create_engine
engine = create_engine('...')
inspector = inspect(engine)
primary_key = inspector.get_pk_constraint("table_name")  # returns empty
foreign_keys = inspector.get_foreign_keys("table_name")  # returns empty

Given this situation, I am wondering if there's an alternative method to extract this data without having to resort to SQL Queries on INFORMATION_SCHEMA?

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery-sqlalchemy API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions