lazy=joined for Device.owner

This commit is contained in:
Jörn-Michael Miehe 2022-04-05 01:26:48 +00:00
parent c94e07fbac
commit 143e9a9fa9
2 changed files with 6 additions and 5 deletions

View file

@ -56,6 +56,9 @@ class Device(DeviceRead, table=True):
# might be a future problem?
owner: User = Relationship(
back_populates="devices",
sa_relationship_kwargs={
"lazy": "joined",
},
)
@classmethod

View file

@ -301,11 +301,9 @@ if __name__ == "__main__":
Connection.connect(current_config.db.uri)
if (device := Device.get(1)) is not None:
with Connection.session as db:
db.add(device)
dn = DistinguishedName.build(device)
client = easy_rsa.issue(dn=dn)
client = easy_rsa.issue(
dn=DistinguishedName.build(device)
)
for cert in (ca, server, client):
if cert is not None: