mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 04:19:18 +08:00
31 lines
695 B
Python
31 lines
695 B
Python
import fire
|
|
from sqlalchemy import and_
|
|
from mishards import db, settings
|
|
|
|
|
|
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__':
|
|
db.init_db(settings.DefaultConfig.SQLALCHEMY_DATABASE_URI)
|
|
from mishards import models
|
|
fire.Fire(DBHandler)
|