milvus/shards/manager.py

30 lines
663 B
Python
Raw Normal View History

2019-10-21 16:21:32 +08:00
import fire
from sqlalchemy import and_
2019-10-25 10:20:37 +08:00
from mishards import db, settings
2019-10-21 16:21:32 +08:00
class DBHandler:
@classmethod
def create_all(cls):
db.create_all()
@classmethod
def drop_all(cls):
db.drop_all()
@classmethod
def fun(cls, tid):
from mishards.factories import TablesFactory, TableFilesFactory, Tables
f = db.Session.query(Tables).filter(and_(
Tables.table_id == tid,
Tables.state != Tables.TO_DELETE)
).first()
print(f)
# f1 = TableFilesFactory()
if __name__ == '__main__':
2019-10-25 10:20:37 +08:00
db.init_db(settings.DefaultConfig.SQLALCHEMY_DATABASE_URI)
2019-10-21 16:21:32 +08:00
fire.Fire(DBHandler)