lot_manager/create_db.py

29 lines
859 B
Python
Raw Normal View History

2023-12-09 15:53:56 +08:00
import time
from api import add
2023-12-05 18:30:33 +08:00
from db.base import Base, engine
2023-12-09 15:53:56 +08:00
from db.models.lot_data_model import LOT_DATA
try:
2023-12-14 14:21:17 +08:00
Base.metadata.create_all(bind=engine)
2023-12-09 15:53:56 +08:00
data = {'ambient_temperature': -1,
'ambient_humidity': -1,
'carbon_dioxide': -1,
'ambient_air_pressure': -1,
'ambient_lighting': -1,
'soil_moisture': -1,
'soil_temperature': -1,
'soil_conductivity': -1,
'soil_PH': -1,
'soil_potassium_phosphate_nitrogen': -1,
'soil_potassium_phosphate_phosphorus': -1,
'soil_potassium_phosphate_potassium': -1,
'rainfall': -1,
'wind_speed': -1,
'wind_direction': -1,
2023-12-11 16:51:15 +08:00
'create_time': int(time.time())
2023-12-09 15:53:56 +08:00
}
t2 = LOT_DATA(**data)
add(t2)
except Exception as e:
2023-12-11 17:47:45 +08:00
pass