mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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:
parent
621e459dfb
commit
15b1332656
3 changed files with 106 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue