From ca7033f6dfb345653de258e56b0a2377be8d26ae Mon Sep 17 00:00:00 2001 From: Xavier Bustamante Talavera Date: Wed, 23 Jan 2019 17:59:29 +0100 Subject: [PATCH] Fix sqlalchemy warnings; improve CLI --- ereuse_devicehub/devicehub.py | 2 +- ereuse_devicehub/resources/lot/models.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/devicehub.py b/ereuse_devicehub/devicehub.py index 88520f77..17061e64 100644 --- a/ereuse_devicehub/devicehub.py +++ b/ereuse_devicehub/devicehub.py @@ -78,7 +78,7 @@ class Devicehub(Teal): @click.option('--erase/--no-erase', default=False, help='Delete the full database before? Including all schemas and users.') - @click.option('--common', + @click.option('--common/--no-common', default=False, help='Creates common databases. Only execute if the database is empty.') def init_db(self, name: str, diff --git a/ereuse_devicehub/resources/lot/models.py b/ereuse_devicehub/resources/lot/models.py index baebd05b..ce0f986a 100644 --- a/ereuse_devicehub/resources/lot/models.py +++ b/ereuse_devicehub/resources/lot/models.py @@ -255,7 +255,7 @@ class LotDeviceDescendants(db.Model): _desc.c.id.label('parent_lot_id'), _ancestor.c.id.label('ancestor_lot_id'), None - ]).select_from(_ancestor).select_from(lot_device).where(descendants) + ]).select_from(_ancestor).select_from(lot_device).where(db.text(descendants)) # Components _parent_device = Device.__table__.alias(name='parent_device') @@ -270,7 +270,7 @@ class LotDeviceDescendants(db.Model): _desc.c.id.label('parent_lot_id'), _ancestor.c.id.label('ancestor_lot_id'), LotDevice.device_id.label('device_parent_id'), - ]).select_from(_ancestor).select_from(lot_device_component).where(descendants) + ]).select_from(_ancestor).select_from(lot_device_component).where(db.text(descendants)) __table__ = create_view('lot_device_descendants', devices.union(components))