add Package SQLAlchemy ORM model

Additionally, add an optional **kwargs passing via make_relationship.
This allows us to use things like `uselist=False`, which was needed
for test/test_package.py.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-01 00:25:49 -07:00
parent 621e459dfb
commit 15b1332656
3 changed files with 106 additions and 2 deletions

View file

@ -53,9 +53,10 @@ def make_random_value(table: str, column: str):
return string
def make_relationship(model, foreign_key, backref_):
def make_relationship(model, foreign_key: str, backref_: str, **kwargs):
return relationship(model, foreign_keys=[foreign_key],
backref=backref(backref_, lazy="dynamic"))
backref=backref(backref_, lazy="dynamic"),
**kwargs)
def query(model, *args, **kwargs):