From c076be84391909f601432fa9a861e26bbde157eb Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Sat, 9 Dec 2023 15:53:56 +0800 Subject: [PATCH] update --- __pycache__/api.cpython-310.pyc | Bin 0 -> 1047 bytes __pycache__/device.cpython-310.pyc | Bin 0 -> 345 bytes create_db.py | 33 ++++++++++++++++-- db/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 146 bytes db/__pycache__/base.cpython-310.pyc | Bin 0 -> 790 bytes db/__pycache__/session.cpython-310.pyc | Bin 0 -> 1307 bytes db/base.py | 1 + .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 153 bytes db/models/__pycache__/base.cpython-310.pyc | Bin 0 -> 1118 bytes .../lot_data_model.cpython-310.pyc | Bin 0 -> 3337 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 193 bytes .../lot_data_repository.cpython-310.pyc | Bin 0 -> 1814 bytes 12 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 __pycache__/api.cpython-310.pyc create mode 100644 __pycache__/device.cpython-310.pyc create mode 100644 db/__pycache__/__init__.cpython-310.pyc create mode 100644 db/__pycache__/base.cpython-310.pyc create mode 100644 db/__pycache__/session.cpython-310.pyc create mode 100644 db/models/__pycache__/__init__.cpython-310.pyc create mode 100644 db/models/__pycache__/base.cpython-310.pyc create mode 100644 db/models/__pycache__/lot_data_model.cpython-310.pyc create mode 100644 db/repository/__pycache__/__init__.cpython-310.pyc create mode 100644 db/repository/__pycache__/lot_data_repository.cpython-310.pyc diff --git a/__pycache__/api.cpython-310.pyc b/__pycache__/api.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e806fd300d415ec3e05cd01565174a22876e6f49 GIT binary patch literal 1047 zcmZ`&OK;Oa5Z;IFIH?n$6p;frBqSeb{s2Ohhr|H|L@HJIVma9*G5Dq3MI}*EA*I*e z_!Id{K5*g0of8LOW|O8R5@YS|%&fh$-}jBncDqHu7F{F1F+#p$aNRfrPhjXiOo9lS zk(@@9qR%px^N3rYXHM=$Ztg{1-iR8Ib0mMyge$yrC-Ox@_~#^Qil%76+7f#M5(You zOcK&Mc$#SWR_dxOw1n7y_4+t|esp{k@;XR_h(8WvQ^sOgcZJNPk(dzDBxx28r?E+M zS+~d1T%~JABqkYAEU+;^M-b~X7#7XUH)KwhfW^=yIUxh$5W}VqC|N*mwr}{Hu6G4B z4*G&!uoL2ucYuCD&*)&Yp3+mY;{Eg|)LXII8I?lTJlEsURSuL>Si5e%_&k!8Nz0;k zE0q?e=Gv$gQw`juaz)fF@P0k)P0C#MvUHN9y=rPEW${LpALPjBURIhoPl{wLRWGU1 z!)jV{AjpI7^i7x;_2KEjxJUgj?6ItBSOw^HFw3KsHiqjxu%5yzThQxiAHv#OOMC-- zjUO}GvXCsGKk5KdBN$uzN7qY0OR@k}=g_YgbgL`^LS+#UTdOPh{}m0Len_o2=~oa| zHK8QnL#}u5DZK114j&s5yYMb-Zjg910C6@*?m)gD?nNCjJj|hEGJQCN|6tuL-K!*O zj_1VoC4~Y;ZP-?_Ds^f~HC;EECEnf+MYlvLta0sP*k8)B>_39jK4tPT{vsNc3P?Z? KXovgF!2b&>64xLA literal 0 HcmV?d00001 diff --git a/__pycache__/device.cpython-310.pyc b/__pycache__/device.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a36c057e4002817a679bfe8caf23ab4cfc0155c GIT binary patch literal 345 zcmYjLF;2rk5WMr*#uy?b3Y3!81(=coMKlyN$PyIDLW+!ci5;DN*4-H?`2&A&N?wvb zTua3ls8|Pzth6(`($4It$s}e}&u135#9!mGUm-2G)MiEi47g-DL$>7LEjS38ys^Rm z@Nk) z0#l)sE;JTYZ+DDZuY=ycU0f%zi%tL9X;q>zF341et@E?{?9TDd9hItS`nD#2bYheX z(z+0^RDfh{bxl`$A3vEsp-emYx%$f_>#C^JZe=UgW?C(=v?i6x&YPkw7O4LdUv?`O V-82e%i8D?nCL)N~)H~*<{1;{?WaR(= literal 0 HcmV?d00001 diff --git a/create_db.py b/create_db.py index 2c18656..3c561c9 100755 --- a/create_db.py +++ b/create_db.py @@ -1,3 +1,32 @@ -from db.base import Base, engine +import time -Base.metadata.create_all(bind=engine) \ No newline at end of file +from api import add +from db.base import Base, engine +from db.models.lot_data_model import LOT_DATA +from device import device_name + +Base.metadata.create_all(bind=engine) +try: + 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, + 'create_time': int(time.time()), + 'device_name': 'test' + } + t2 = LOT_DATA(**data) + add(t2) +except Exception as e: + print(e) + pass \ No newline at end of file diff --git a/db/__pycache__/__init__.cpython-310.pyc b/db/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a7a44555ecdb48eceab60f6bff356443958cf89 GIT binary patch literal 146 zcmd1j<>g`k0)b~msUZ3>h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o6vMKO;XkRX-;) zBQaCIpt2+*KQEvtKPxr4q*y;Eza&04F)uMawMaiDNk2Y5GcU6wK3=b&@)n0pZhlH> PPO2TqxMC(C!NLFlnlT{+ literal 0 HcmV?d00001 diff --git a/db/__pycache__/base.cpython-310.pyc b/db/__pycache__/base.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..972cdcf091a51ee587c2c23581b14b10b98e74d5 GIT binary patch literal 790 zcmY*X&2AGh5VpO$`PuAlN-sziFOW-CNSshrk^ZTO{?W7td|5f`q1n`42irk3;s)Z@ zCqPJWj9eI3Vm6sbQoU&v@+lKF?UCX^fow*s$<~AoSA*s}i~3nN#!0nG3`b z#{yBm5`iV51baUafedLVBO2Ytp=ilAZQuG>bZCc1vE;@c=hzsexH2puVhX z7?5U-Ln)YMwt5T2gc)f1yZ1XsV41s>7%-+%wPaVIm;HRIB;=x+vMQff`LZXJEjY7m z$S2F#yb+a!r+J>2*u(x4?}tuzoSMuTi)Q$}7fkio?9Gp-y;(XE?@$5ZuD8KUuU+{sNm- B(!>A& literal 0 HcmV?d00001 diff --git a/db/__pycache__/session.cpython-310.pyc b/db/__pycache__/session.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d1d7fc2a7900b514688c2e58d65842eb76cbc36 GIT binary patch literal 1307 zcmZWo-)j^}5bo;vxtrNdkX+O|juYhI2F~mq_;dsj1fL|x1y0m}MlS6A0mcU67$byBNU8IGy< zD*Dr4>>X_m4ih(Laq2551QQ@x3{3#ix#Y3YGz#62W^6UBLN}!yJ52{zWC$y=mbkEm zvu+Nd=?Yg=)>*THb_eZMF|lqotL4rUHQY^z`U3MO_c0!O0l76$K~MXT*TbZnM%U9g z=myJ?LW{EyY28V>=;f8_g(M7QZmTHmt8PeFj0d3N;v}O!kK!gv*^sTV)#Iy`jQzrZ zW$YO|$Mq8Hx`1n8;bggmHvDUlE@0uKK43oY|Ad!qzqz;l=KlL98@qoz-+gpv=jqn& zr+cqn&HJWu@P^zDlQ{0AxvLT> zTS0g=w?didhziwZp-k1#^`Fy?b`nPo*=YxzMsFo;C*6xGxe|q`Zpb8EEFo%$R--&Q z+gr(NrM{@cq!$qudKv}4VH+mc;Nf(E1OG5%sY(115@h4SQ6VlMN0>f_B4u~k5H{En z2oQYT9l{!92#s&dAHtmuQLJz1;IAkM^@k_d`0DYyEaS_NvESfl)?pd^4x6xMWPH?x z%(#T8b0nIH-w6a}aXhEv3E-^|TGE$iIA zI-pf~Xe65GzD$umuv7r6>ST6^alJ?##Z7^b%Q?&-HYQB{Yg>fT^xvyr4?1akaSZRA zB;x5av*lSuc==p?fs2|UL5)*{_b7;W@HjbW8-)#ZFsnu6Lm(a^?|10@3Th0d4(oT8J&3mYL-U!gMZdwFH4-wo3wky;sO%B$sjmz|a( z=Vo1BlYtD|QM@vns90I#<%rg7E6~xXLZWSfUXgZj^?@Y*uh*T66VaE^87f2{LE$kE QUx3HCF$Hd|K6%9b4{u8xy#N3J literal 0 HcmV?d00001 diff --git a/db/base.py b/db/base.py index 31dc913..b4e027c 100755 --- a/db/base.py +++ b/db/base.py @@ -5,6 +5,7 @@ from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta from sqlalchemy.orm import sessionmaker import json + KB_ROOT_PATH = "/home/pi/" DB_ROOT_PATH = os.path.join(KB_ROOT_PATH, "lot_data.db") SQLALCHEMY_DATABASE_URI = f"sqlite:///{DB_ROOT_PATH}" diff --git a/db/models/__pycache__/__init__.cpython-310.pyc b/db/models/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..833c408773e3831851033b9dc547558e11e84804 GIT binary patch literal 153 zcmd1j<>g`k0)b~msUZ3>h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o6v8KO;XkRX-;) zBQaCIpt2+*KQEvtKPxr4q*y;Eza&04F)uMawMaiDNk2C~B{ip5KR!M)FS8^*Uaz3? V7KaT`urw#t4rFRE6OdqG005}_BfbCt literal 0 HcmV?d00001 diff --git a/db/models/__pycache__/base.cpython-310.pyc b/db/models/__pycache__/base.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15db5956411e4282aa9c187a52d153f5fe148d60 GIT binary patch literal 1118 zcmZuwOKTKC5bk;GymmKPf{z@%?!^U99z>!BBnN|-cU04KZNh0j&Mbb+cyYzs3&~DF5ngo zL4333mVz-IF(wOM zXNWtDZP#%&i>NkManiif^NhuLUQ}_FLVd~s+5a-#KkD1s=i+f(XO+4Pu~m~XIXIfU`Fxt;s6`0SpvdbH zPN2!FQLb5`Upp_1H+u=Z{=AxlsG3L91EYP$c#%N+T6lzfwViT>Ix6_R2=(eJ$&07D zohSiUFr0GQp5130<58b<&C literal 0 HcmV?d00001 diff --git a/db/models/__pycache__/lot_data_model.cpython-310.pyc b/db/models/__pycache__/lot_data_model.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc7277d61a7296b9ecb522753830b887a41637ca GIT binary patch literal 3337 zcmb`KS#KLv6vt=0@39kSYYVs=)R5GZgp{pDETyEPl!%rWzl1NE6Ke4AUY#1GD0BHv zVM1`C3SMiEmEKIrl0>D7Or%QS8HomoOadf$Do_d0FpZGV?zR?2ElOiTi}+d;wKz=( zE#_-+)RL$rd@YGu3bmB4rBO?xmhrVN)H0}LeJzJt7i!(U)`MCWwY;zOqLxFg&)51< z>qc$B*9KARL2ZMtZA2}P+9qGS1+`w(ZuPa>Q0qgj;A@*v>ql*iuWdzb0JUwq#Y&5H z+RkJ9pE{)OdHB%72bNP}C4RsBgZJrNYw=z0&2PjiB?)z^Os~1RZ9(ICy-HO}GiiN5 zID040df#1bzW4RgdtdHo|1?j2Q7rIel~K*5s;irHxmS2Doj<+w@<-Pf-`}BlCl|() zqFHhZJn@2V5!Ik>F`DuY?(1GZTR-p&W-NLDL`g8A-W6dj< zysMvyfWI6+#(Ok#N~e~qy40*urnz-S*ZO|@W7~K8(-S<~@tvugI?>(PWf;kCSKnwZ zT=3p_xAn;vBB*k7Tv3!-&E%P?#-?mbCA$5hPUv#~Y7Z99c&A@S=aEt6iAjy;JE1k5 zsWnC&2l|nOft|g$H20?PHBBC4nr6_}8$W9!Dc*?@lg?w#3ChDQ_y zrX-EtrmZ_Taks6ww$6OzeZJT_J%>FT6;q;ITRd2*nmmV>RBemY#mYPn(6 zbGr2GG~bL@*KAjF9KCL;wHe!~&A?-2=`ORUsda<6;vRpCJAMz06~hkktv8I@zJtx` z&J7}qe*Z1g&M1n5Jf`9fQdOQ%RnsPQg9=Wm>T`9?fW4)vEGQ<7 z#f9NP$7Q@rRW-{JF<=)s;ymPZ9@H(D!KUTm!-lQ743>bwMq;p0SRPCt7_r}u}xYs^chVr)n?rp+nQwd5wRVel3}~5sae`I zWhF9I5+k8TTP2#S!N{nwvo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