forked from kokes/od
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.py
380 lines (374 loc) · 19.1 KB
/
schema.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
from sqlalchemy import Column, MetaData, Table
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql.sqltypes import (
Boolean,
Date,
DateTime,
Integer,
Numeric,
SmallInteger,
Text,
)
meta = MetaData()
schema = [
Table(
"etrziste_casti_vz",
meta,
Column("VZsystemoveCislo", Text, nullable=True),
Column("CastVZcislo", SmallInteger, nullable=True),
Column("SmluvniCenaVcetneDPH", Numeric(14, 2)),
Column("SmluvniCenaBezDPH", Numeric(14, 2)),
Column("SmluvniCenaSazbaDPH", Numeric(14, 2)),
Column("SmluvniCenaMena", Text), # TODO: enum?
),
Table(
"etrziste_polozky_vz",
meta,
Column("VZsystemoveCislo", Text, nullable=True),
Column("NIPEZkod", Text, nullable=True),
Column("NIPEZnazev", Text, nullable=True),
Column("NIPEZpovinnostProEtrziste", Text, nullable=True),
Column("NIPEZnazevVlastnosti", Text, nullable=True),
Column("NIPEZdatovyTypVlastnosti", Text, nullable=True),
Column("NIPEZhodnotaVlastnosti", Text, nullable=True),
Column("NIPEZmernaJednotkaVlastnosti", Text, nullable=True),
Column("NIPEZoperatorVlastnosti", Text, nullable=True),
),
Table(
"etrziste_kriteria_vz",
meta,
Column("VZsystemoveCislo", Text, nullable=True),
Column("DilciHodnoticiKriterium", Text, nullable=True),
Column("DilciHodnoticiKriteriumVaha", Numeric(5, 2)),
Column("DilciKriteriumCiselneVyjadritelne", Text, nullable=True),
Column("DilciKriteriumPredmetemEaukce", Text, nullable=True),
Column(
"DilciKriteriumZadavatelPozadovalVlozeniNabidkovychHodnot",
Text,
nullable=True,
),
Column("SubkriteriumNabidkoveCeny", Text, nullable=True),
Column("SubkriteriumNabidkoveCenyVaha", Numeric(5, 2)),
Column("SubkriteriumDilcihoKriteria", Text, nullable=True),
Column("SubkriteriumDilcihoKriteriaVaha", Numeric(5, 2)),
Column("SubkriteriumCiselneVyjadritelne", Text, nullable=True),
Column("SubkriteriumPredmetemEaukce", Text, nullable=True),
Column(
"SubkriteriumZadavatelPozadovalVlozeniNabidkovychHodnot",
Text,
nullable=True,
),
),
Table(
"etrziste_dodavatele",
meta,
Column("VZsystemoveCislo", Text, nullable=True),
Column("CastVZcislo", SmallInteger, nullable=True),
Column("DatumUzavreniSmlouvy", DateTime, nullable=True),
Column("DodavatelUredniNazev", Text, nullable=True),
Column("DodavatelICO", Integer, nullable=True, index=True),
Column("DodavatelStat", Text, nullable=True),
),
Table(
"etrziste_vz",
meta,
Column("NazevEtrziste", Text, nullable=True),
Column("VZsystemoveCislo", Text, nullable=True),
Column("NazevVZ", Text, nullable=True),
Column("VZstav", Text, nullable=True),
Column("VZdruh", Text, nullable=True),
Column("VZtyp", Text, nullable=True),
Column("DruhZadavaciRizeni", Text, nullable=True),
Column("PredpokladanaHodnotaVZ", Numeric(14, 2)),
Column("CelkovaSmluvniCenaBezDPH", Numeric(14, 2)),
Column("CelkovaSmluvniCenaVcetneDPH", Numeric(14, 2)),
Column("CelkovaSmluvniCenaMena", Text, nullable=True),
Column("ZadavatelNazev", Text, nullable=True),
Column("ZadavatelICO", Integer, nullable=True, index=True),
Column("ZadavatelKategorie", Text, nullable=True),
Column("VysledekZadavacihoRizeni", Text, nullable=True),
Column("DatumUzavreniSmlouvy", Date, nullable=True),
Column("DelenaNaCasti", Text, nullable=True),
Column("PocetCasti", Text, nullable=True),
Column("PocetPolozekVZ", Text, nullable=True),
Column("MetodaHodnoceni", Text, nullable=True),
Column("ZakladniHodnoticiKriterium", Text, nullable=True),
Column("ZruseniVZ", Text, nullable=True),
Column("DatumZruseniZadavacihoRizeni", Date, nullable=True),
Column("BylaDoZRzarazenaEaukce", Text, nullable=True),
Column("PocetVyzvanychDodavatelu", Text, nullable=True),
Column("PocetObdrzenychNabidek", Text, nullable=True),
Column("PocetHodnocenychNabidek", Text, nullable=True),
Column("NamitkyPocet", Text, nullable=True),
Column("NamitkyVyhoveno", Text, nullable=True),
Column("PrezkumUkonu", Text, nullable=True),
Column("PrezkumnychRizeniPocet", Text, nullable=True),
Column("ZadostioDodatecneInformacePocet", Text, nullable=True),
Column("DodavatelNazev", Text, nullable=True),
Column("dodavatelICO", Integer, nullable=True, index=True),
),
Table(
"vvz_casti_vz",
meta,
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("CisloCastiZadaniVZ", Text, nullable=True),
Column("NazevCastiVZ", Text, nullable=True),
Column("DatumZadaniVZ", Date, nullable=True),
Column("PocetObdrzenychNabidek", Integer, nullable=True),
Column("DodavatelNazev", Text, nullable=True),
Column("DodavatelICOZeZadani", Integer, nullable=True, index=True),
Column("DodavatelPostovniAdresa", Text, nullable=True),
Column("DodavatelObec", Text, nullable=True),
Column("DodavatelPSC", Text, nullable=True),
Column("DodavatelStat", Text, nullable=True),
Column("DodavatelWww", Text, nullable=True),
Column("PuvodniOdhadovanaCelkovaHodnotaVZ", Numeric(16, 2)),
Column("PuvodniOdhadovanaCelkovaHodnotaVZMena", Text, nullable=True),
Column("PuvodniOdhadovanaCelkovaHodnotaVZsazbaDPH", Text, nullable=True),
Column("PuvodniOdhadovanaCelkovaHodnotaVZprocentniSazbaDPH", Numeric(4, 2)),
Column("CelkovaKonecnaHodnotaVZzaZadani", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZmenaZaZadani", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZSazbaDPHzaZadani", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZprocentniSazbaDPHzaZadani", Text, nullable=True),
Column("HodnotaNejnizsiNabidky", Numeric(14, 2)),
Column("HodnotaNejnizsiNabidkyMena", Text, nullable=True),
Column("HodnotaNejnizsiNabidkySazbaDPH", Text, nullable=True),
Column("HodnotaNejnizsiNabidkyProcentniSazbaDPH", Numeric(4, 2)),
Column("RocniCiMesicniHodnotaPocetRoku", Integer, nullable=True),
Column("RocniCiMesicniHodnotaPocetMesicu", Integer, nullable=True),
Column("SubdodavkyHodnotaBezDPH", Numeric(14, 2)),
Column("SubdodavkyMena", Text, nullable=True),
Column("SubdodavkyPomer", Numeric(5, 2)),
Column("PlatnyFormular", Boolean, nullable=True),
),
Table(
"vvz_vz",
meta,
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("DruhFormulare", Text, nullable=True),
Column("TypFormulare", Text, nullable=True),
Column("VZdelenaNaCasti", Text, nullable=True),
Column("ZadavatelICO", Integer, nullable=True, index=True),
Column("DodavatelICO", Integer, nullable=True, index=True),
Column("LimitVZ", Text, nullable=True),
Column("DatumOdeslaniFormulareNaVVZ", Date, nullable=True),
Column("DatumUverejneni", Date, nullable=True),
Column("ZadavatelUredniNazev", Text, nullable=True),
Column("ZadavatelDruh", Text, nullable=True),
Column("ZadavatelHlavniPredmetCinnosti", Text, nullable=True),
Column("ZadavatelZadavaJmenemJinych", Text, nullable=True),
Column("NazevVZ", Text, nullable=True),
Column("DruhVZ", Text, nullable=True),
Column("KategorieSluzeb", Text, nullable=True),
Column("HlavniMistoPlneni", Text, nullable=True),
Column("StrucnyPopisVZ", Text, nullable=True),
Column("CPVhlavni", Text, nullable=True),
Column("CPVdoplnkovy1", Text, nullable=True),
Column("CPVdoplnkovy2", Text, nullable=True),
Column("DruhyPredmetCPVhlavni", Text, nullable=True),
Column("DruhyPredmetCPVdoplnkovy1", Text, nullable=True),
Column("DruhyPredmetCPVdoplnkovy2", Text, nullable=True),
Column("TretiPredmetCPVhlavni", Text, nullable=True),
Column("TretiPredmetCPVdoplnkovy1", Text, nullable=True),
Column("TretiPredmetCPVdoplnkovy2", Text, nullable=True),
Column("CtvrtyPredmetCPVhlavni", Text, nullable=True),
Column("CtvrtyPredmetCPVdoplnkovy1", Text, nullable=True),
Column("CtvrtyPredmetCPVdoplnkovy2", Text, nullable=True),
Column("PatyPredmetCPVhlavni", Text, nullable=True),
Column("PatyPredmetCPVdoplnkovy1", Text, nullable=True),
Column("PatyPredmetCPVdoplnkovy2", Text, nullable=True),
Column("NaVZseVztahujeGPA", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZ", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZmena", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZsazbaDPH", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZprocentniSazbaDPH", Text, nullable=True),
Column("NejnizsiNabidkaVzataVuvahu", Text, nullable=True),
Column("NejnizsiNabidkaVzataVuvahuMena", Text, nullable=True),
Column("NejnizsiNabidkaVzataVuvahuSazbaDPH", Text, nullable=True),
Column("NejnizsiNabidkaVzataVuvahuProcentniSazbaDPH", Text, nullable=True),
Column("NejvyssiNabidkaVzataVuvahu", Text, nullable=True),
Column("DruhRizeni", Text, nullable=True),
Column("HlavniKriteriaProZadaniZakazky", Text, nullable=True),
Column("Kriterium1", Text, nullable=True),
Column("VahaKriteria1", Text, nullable=True),
Column("Kriterium2", Text, nullable=True),
Column("VahaKriteria2", Text, nullable=True),
Column("Kriterium3", Text, nullable=True),
Column("VahaKriteria3", Text, nullable=True),
Column("Kriterium4", Text, nullable=True),
Column("VahaKriteria4", Text, nullable=True),
Column("Kriterium5", Text, nullable=True),
Column("VahaKriteria5", Text, nullable=True),
Column("Kriterium6", Text, nullable=True),
Column("VahaKriteria6", Text, nullable=True),
Column("Kriterium7", Text, nullable=True),
Column("VahaKriteria7", Text, nullable=True),
Column("Kriterium8", Text, nullable=True),
Column("VahaKriteria8", Text, nullable=True),
Column("Kriterium9", Text, nullable=True),
Column("VahaKriteria9", Text, nullable=True),
Column("Kriterium10", Text, nullable=True),
Column("VahaKriteria10", Text, nullable=True),
Column("BylaPouzitaElektronickaDrazba", Text, nullable=True),
Column("ZakazkaSeVztahujeKprojektuFinZes", Text, nullable=True),
Column("ProjektyCiprogramy", Text, nullable=True),
Column("OdhadovanaHodnotaVZbezDPH", Numeric(14, 2)),
Column("OdhadovanaHodnotaVZmena", Text, nullable=True),
Column("OdhadovanaHodnotaVZrozsahOd", Numeric(14, 2)),
Column("OdhadovanaHodnotaVZrozsahDo", Numeric(14, 2)),
Column("OdhadovanaHodnotaVZrozsahMena", Text, nullable=True),
Column("PlatnyFormular", Boolean, nullable=True),
),
Table(
"zzvz_zadani_vz",
meta,
Column("ID_Zakazky", Text, nullable=True),
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("DruhFormulare", Text, nullable=True),
Column("ID_Zadani", Text, nullable=True),
Column("CisloCastiZadaniVZ", Text, nullable=True),
Column("NazevCastiVZ", Text, nullable=True),
Column("ZadaniCastiZakazky", Text, nullable=True),
Column("InformaceONezadaniCastiZakazky", Text, nullable=True),
Column("DatumZadaniVZ", DateTime, nullable=True),
Column("PocetObdrzenychNabidek", Text, nullable=True),
Column("PuvodniOdhadovanaCelkovaHodnotaVZ", Numeric(16, 2)),
Column("PuvodniOdhadovanaCelkovaHodnotaVZMena", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZzaZadani", Numeric(16, 2)),
Column("CelkovaKonecnaHodnotaVZmenaZaZadani", Text, nullable=True),
Column("HodnotaNejnizsiNabidky", Numeric(14, 2)),
Column("HodnotaNejnizsiNabidkyMena", Text, nullable=True),
Column("HodnotaNejvyssiNabidky", Numeric(14, 2)),
Column("SubdodavkyHodnotaBezDPH", Numeric(14, 2)),
Column("SubdodavkyMena", Text, nullable=True),
Column("SubdodavkyPomer", Numeric(5, 2)),
Column("DatumOdeslaniFormulareNaVVZ", DateTime, nullable=True),
Column("PlatnyFormular", Boolean, nullable=True),
),
Table(
"zzvz_casti_vz",
meta,
Column("ID_Zakazky", Text, nullable=True),
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("DruhFormulare", Text, nullable=True),
Column("ID_CastiVZ", Text, nullable=True),
Column("CisloCastiVZ", Text, nullable=True),
Column("NazevCastiVZ", Text, nullable=True),
Column("PopisCastiVZ", Text, nullable=True),
Column("PredpokladanaCelkovaHodnotaCastiVZ", Numeric(14, 2)),
Column("PredpokladanaCelkovaHodnotaCastiVZMena", Text, nullable=True),
Column("HlavniMistoPlneniNUTS", Text, nullable=True),
Column("HlavniMistoPlneni", Text, nullable=True),
Column("CPVkod", Text, nullable=True),
Column("ZakazkaSeVztahujeKprojektuFinZes", Text, nullable=True),
Column("ProjektyCiProgramyFinZes", Text, nullable=True),
Column("DatumOdeslaniFormulareNaVVZ", DateTime, nullable=True),
Column("PlatnyFormular", Boolean, nullable=True),
),
Table(
"zzvz_dodavatele",
meta,
Column("ID_Zakazky", Text, nullable=True),
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("DruhFormulare", Text, nullable=True),
Column("ID_Zadani", Text, nullable=True),
Column("CisloCastiZadaniVZ", Text, nullable=True),
Column("NazevCastiVZ", Text, nullable=True),
Column("DodavatelICO", Integer, nullable=True, index=True),
Column("DodavatelNazev", Text, nullable=True),
Column("DodavatelPostovniAdresa", Text, nullable=True),
Column("DodavatelObec", Text, nullable=True),
Column("DodavatelPSC", Text, nullable=True),
Column("DodavatelStat", Text, nullable=True),
Column("DodavatelWww", Text, nullable=True),
Column("DatumOdeslaniFormulareNaVVZ", DateTime, nullable=True),
Column("PlatnyFormular", Boolean, nullable=True),
),
Table(
"zzvz_vz",
meta,
Column("ID_Zakazky", Text, nullable=True),
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("DruhFormulare", Text, nullable=True),
Column("TypFormulare", Text, nullable=True),
Column("VZdelenaNaCasti", Text, nullable=True),
Column("ZadavatelICO", Integer, nullable=True, index=True),
Column("LimitVZ", Text, nullable=True),
Column("DatumOdeslaniFormulareNaVVZ", DateTime, nullable=True),
Column("DatumUverejneni", DateTime, nullable=True),
Column("ZadavatelUredniNazev", Text, nullable=True),
Column("ZadavatelDruh", Text, nullable=True),
Column("ZadavatelHlavniPredmetCinnosti", Text, nullable=True),
Column("ZakazkaZahrnujeSpolecneZadavaniZakazek", Text, nullable=True),
Column("ZakazkuZadavaCentralniZadavatel", Text, nullable=True),
Column("ZadavatelProfilURL", Text, nullable=True),
Column("ZadavatelProfilURLPlatnost", Text, nullable=True),
Column("ZadavatelProfilZruseniTyp", Text, nullable=True),
Column("ZadavatelProfilURLNova", Text, nullable=True),
Column("DatumZruseniCiZneaktivneniProfilu", DateTime, nullable=True),
Column("NazevVZ", Text, nullable=True),
Column("DruhVZ", Text, nullable=True),
Column("StrucnyPopisVZ", Text, nullable=True),
Column("CPVhlavni", Text, nullable=True),
Column("CPVdoplnkovy1", Text, nullable=True),
Column("NaVZseVztahujeGPA", Text, nullable=True),
Column("CelkovaKonecnaHodnotaVZ", Numeric(14, 2)),
Column("CelkovaKonecnaHodnotaVZmena", Text, nullable=True),
Column("NejnizsiNabidkaVzataVuvahu", Numeric(14, 2)),
Column("NejnizsiNabidkaVzataVuvahuMena", Text, nullable=True),
Column("NejvyssiNabidkaVzataVuvahu", Numeric(14, 2)),
Column("DruhRizeni", Text, nullable=True),
Column("BylaPouzitaElektronickaDrazba", Text, nullable=True),
Column("OdhadovanaHodnotaVZbezDPH", Numeric(14, 2)),
Column("OdhadovanaHodnotaVZmena", Text, nullable=True),
Column("ZadavatelKontaktniOsoba", Text, nullable=True),
Column("ZadavatelEmail", Text, nullable=True),
Column("ZadavatelTelefon", Text, nullable=True),
Column("LhutaProDoruceniNabidek", Text, nullable=True),
Column("OteviraniNabidekDatumCas", DateTime, nullable=True),
Column("OteviraniNabidekMisto", Text, nullable=True),
Column("OteviraniNabidekOpravneneOsobyDalsiInfo", Text, nullable=True),
Column("UchazecVazanNabidkouDo", Text, nullable=True),
Column("UchazecVazanNabidkouDobaMesice", Text, nullable=True),
Column("PlatnyFormular", Text, nullable=True),
Column("PravidelnePredbezneOznameni", Text, nullable=True),
Column("PravidelnePredbezneOznameniVyzvaKSoutezi", Text, nullable=True),
Column("PredbezneOznameni", Text, nullable=True),
Column("PredbezneOznameniVyzvaKSoutezi", Text, nullable=True),
Column("SystemKvalifikace", Text, nullable=True),
Column("SystemKvalifikaceVyzvaKSoutezi", Text, nullable=True),
Column("OznameniOZahajeniZR", Text, nullable=True),
Column("OznameniOVysledkuZR", Text, nullable=True),
Column("OznameniOVysledkuKS", Text, nullable=True),
),
Table(
"zzvz_kriteria_vz",
meta,
Column("ID_Zakazky", Text, nullable=True),
Column("ID_PopisuCastiZakazky", Text, nullable=True),
Column("EvidencniCisloVZnaVVZ", Text, nullable=True),
Column("CisloFormulareNaVVZ", Text, nullable=True),
Column("DruhFormulare", Text, nullable=True),
Column("CisloCastiVZ", Text, nullable=True),
Column("NazevCastiVZ", Text, nullable=True),
Column("PoradiKriteria", Text, nullable=True),
Column("KriteriumZadaniZakazky", Text, nullable=True),
Column("NazevKriteria", Text, nullable=True),
Column("VahaKriteria", Text, nullable=True),
Column("DatumOdeslaniFormulareNaVVZ", DateTime, nullable=True),
Column("PlatnyFormular", Boolean, nullable=True),
),
]
# -- TODO: foreign keys? composite primary keys?
if __name__ == "__main__":
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import CreateTable
for table in schema:
print(f"-- {table.name} as created in Postgres")
print(CreateTable(table).compile(dialect=postgresql.dialect()))