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

SQLAlchemy connector #381

Open
4 tasks
webb-ben opened this issue Apr 24, 2023 · 1 comment
Open
4 tasks

SQLAlchemy connector #381

webb-ben opened this issue Apr 24, 2023 · 1 comment
Assignees

Comments

@webb-ben
Copy link
Member

User story

As an NLDI Admin, I want to connect to the nldi-database via SQLAlchemy so that I am able to using python framework to structure and process the API request.

Acceptance criteria

  • SQLAlchemy implementation of database connection
  • SQLAlchemy supports all requests currently supported

Definition of done

  • unit/functional tests added/updated
  • documentation updated
@gzt5142
Copy link
Collaborator

gzt5142 commented May 30, 2023

An example of a sqlalchemy connection and ORM for this database is here:

data access layer -- a convenience object to hold db connect details:
https://github.com/gzt5142/nldi-crawler-py/blob/7e0aa4c6230c983a4931561ab6322c2d68ece527/src/nldi_crawler/db.py#L28

The ORM is used in two places in the crawler:

I've chosen a 'classic' binding mechanism to map a table to a simplified dataclass (rather than subclassing DeclarativeBase). This makes the ORM dependent on the dataclass rather than the other way around. Code which manipulates the feature dataclass is protected from knowing sql details this way.

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

No branches or pull requests

2 participants