fasva orm是访问fasva中使用的数据库的orm。
fasvaorm的Python项目详细描述
fasva mysql orm
此项目包含一个对象关系映射(orm),用于访问mysql/mariadb 在研究项目中使用FASva使用sqlalchemy。
使用量
使用fasvaorm访问数据库非常简单。每个可用表都表示为 在fasvaorm.models模块中初始化。下面是一个关于如何初始化和查询数据库的示例。
fromfasvaormimportinit_engine,get_sessionfromfasvaorm.modelsimportDrive# initialize the engine. Will also try to create the database if it does not exist.engine=init_engine("mysql+pymysql://{user}@{host}:{port}/{database}".format(**dict(user='root',host='localhost',port=3306,database='database')))# now get a sessionsession=get_session()# and use that session to query all available drivesfordinsession.query(Drive).all():print(d.name)# use can also access all records of that driveforrind.records:print(r.filepath)# or the vehicleprint(d.vehicle.serial_number)# or also all scenes of that driveforaind.aggregations:print(a.timestamp)
有关如何使用fasvaorm的更多示例,请参阅tests包。