-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_access_IML-2023011.py
99 lines (71 loc) · 2.67 KB
/
make_access_IML-2023011.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import shutil
import pyodbc
import logging
from andes_migrate.capture_mollusque import CaptureMollusque
from andes_migrate.oracle_helper import OracleHelper
from andes_migrate.projet_mollusque import ProjetMollusque
from andes_migrate.trait_mollusque import TraitMollusque
from andes_migrate.engin_mollusque import EnginMollusque
from andes_migrate.freq_long_mollusque import FreqLongMollusque
from andes_migrate.andes_helper import AndesHelper
logging.basicConfig(level=logging.ERROR)
andes_db = AndesHelper()
access_file = 'andes_migrate/ref_data/access_template.mdb'
ref = OracleHelper(access_file=access_file)
# INPUT VALUES
no_notification = "IML-2023-011"
zone = "16E"
espece = "pétoncle"
SEQ_peche = 151
# consider these default hard-coded values
output_fname = f'./{no_notification}.mdb'
shutil.copyfile('andes_migrate/ref_data/access_template.mdb', output_fname)
con = pyodbc.connect(
f"Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};DBQ={output_fname};"
)
output_cur = con.cursor()
# proj = ProjetMollusque(andes_db, output_cur, ref=ref)
# proj.init_input(zone="20", no_releve=34, no_notif=no_notification, espece="pétoncle")
proj = ProjetMollusque(andes_db, output_cur, ref=ref, zone=zone, no_notif=no_notification, espece=espece)
for p in proj:
print(f"Projet: ", p)
trait = TraitMollusque(andes_db, proj, output_cur)
trait_n =0
for t in trait:
trait_n = trait_n +1
no_moll = 1
print(f"Trait: ", t)
if trait_n>0:
engin = EnginMollusque(trait, output_cur)
for e in engin:
print(f"Engin: ", e)
capture = CaptureMollusque(engin, output_cur)
for c in capture:
print(f"Capture: ", c)
freq = FreqLongMollusque(capture, output_cur, no_moll_init=no_moll)
for f in freq:
# print(f"FreqLong: ", f)
# if (c['COD_ESP_GEN'] == 48 or c['COD_ESP_GEN'] == 50) :
no_moll += 1
# monolithic commit if no errors are found
# output_cur.commit()
# for i in range(12):
# trait._increment_row()
# print("trait: ", trait.get_ident_no_trait())
# statement = trait.get_insert_statement()
# cur.execute(statement)
# cur.commit()
# statement = engin.get_insert_statement()
# cur.execute(statement)
# cur.commit()
# capture.populate_data()
# statement = capture.get_insert_statement()
# cur.execute(statement)
# cur.commit()
# freq_long = FreqLongMollusque(capture)
# print("iterating...")
# for i in FreqLongMollusque(capture, output_cur):
# print(i)
# # statement = i.get_insert_statement()
# # cur.execute(statement)
# # cur.commit()