Open webb-ben opened 1 year ago
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:
crawler_source
table https://github.com/gzt5142/nldi-crawler-py/blob/7e0aa4c6230c983a4931561ab6322c2d68ece527/src/nldi_crawler/source.py#L299I'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.
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
Definition of done