Fix sqlalchemy warnings; improve CLI

This commit is contained in:
Xavier Bustamante Talavera 2019-01-23 17:59:29 +01:00
parent f570e9d3d0
commit ca7033f6df
2 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ class Devicehub(Teal):
@click.option('--erase/--no-erase', @click.option('--erase/--no-erase',
default=False, default=False,
help='Delete the full database before? Including all schemas and users.') help='Delete the full database before? Including all schemas and users.')
@click.option('--common', @click.option('--common/--no-common',
default=False, default=False,
help='Creates common databases. Only execute if the database is empty.') help='Creates common databases. Only execute if the database is empty.')
def init_db(self, name: str, def init_db(self, name: str,

View File

@ -255,7 +255,7 @@ class LotDeviceDescendants(db.Model):
_desc.c.id.label('parent_lot_id'), _desc.c.id.label('parent_lot_id'),
_ancestor.c.id.label('ancestor_lot_id'), _ancestor.c.id.label('ancestor_lot_id'),
None None
]).select_from(_ancestor).select_from(lot_device).where(descendants) ]).select_from(_ancestor).select_from(lot_device).where(db.text(descendants))
# Components # Components
_parent_device = Device.__table__.alias(name='parent_device') _parent_device = Device.__table__.alias(name='parent_device')
@ -270,7 +270,7 @@ class LotDeviceDescendants(db.Model):
_desc.c.id.label('parent_lot_id'), _desc.c.id.label('parent_lot_id'),
_ancestor.c.id.label('ancestor_lot_id'), _ancestor.c.id.label('ancestor_lot_id'),
LotDevice.device_id.label('device_parent_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)) __table__ = create_view('lot_device_descendants', devices.union(components))