Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for primary and foreign keys in sqlalchemy #205

Open
mdesmet opened this issue Jul 20, 2022 · 1 comment
Open

Support for primary and foreign keys in sqlalchemy #205

mdesmet opened this issue Jul 20, 2022 · 1 comment

Comments

@mdesmet
Copy link
Contributor

mdesmet commented Jul 20, 2022

In sqlalchemy a user can define primary keys and foreign keys as in the following example.

from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
metadata_obj = MetaData()
users = Table('users', metadata_obj,
    Column('id', Integer, primary_key=True),
    Column('name', String),
    Column('fullname', String),
)

addresses = Table('addresses', metadata_obj,
  Column('id', Integer, primary_key=True),
  Column('user_id', None, ForeignKey('users.id')),
  Column('email_address', String, nullable=False)
 )

Primary key or foreign key constraints are not (yet) supported in Trino (For example Snowflake allows to define constraints but is not actually enforcing)

sqlalchemy might depend on these configurations to generate CRUD queries (Trino also doesn't support things like auto increments so there might be other issues as well).

We can either:

  1. Block setting up constraints
  2. Allow setting up constraints (but silently ignoring them from the database perspective)
@ebyhr
Copy link
Member

ebyhr commented Jul 20, 2022

Phoenix connector already supports primary_key column property. Generally, we prefer failure to ignoring in this project (including Trino).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants