trinodb / trinodb/trino-python-client
Support for primary and foreign keys in sqlalchemy
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 439
- Forks
- 206
- PR merge metrics
- No merged PRs in 30d
Description
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:
- Block setting up constraints
- Allow setting up constraints (but silently ignoring them from the database perspective)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SQLAlchemy Table and Column example in the issue and investigate how primary_key and ForeignKey configurations reach Trino. Determine whether constraints should be rejected or accepted and ignored, while checking the stated CRUD-query and auto-increment compatibility concerns; done means one behavior is chosen and supported consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlalchemy
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100