diff options
author | Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com> | 2021-02-08 21:27:53 +0100 |
---|---|---|
committer | Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com> | 2021-02-08 21:27:53 +0100 |
commit | d0e2a39f694324815e263f0587e6827f7ef26f09 (patch) | |
tree | f0919ef1102e2acf84eea8d7eea00b8d7928e6d7 | |
parent | d0458229daf205f2da50f40fa0ea59b20be5513e (diff) | |
download | justice-d0e2a39f694324815e263f0587e6827f7ef26f09.tar.gz |
clean up changes
-rw-r--r-- | db_creation | 31 | ||||
-rw-r--r-- | justice_main.py | 8 |
2 files changed, 35 insertions, 4 deletions
diff --git a/db_creation b/db_creation index f2976b4..9fc44e0 100644 --- a/db_creation +++ b/db_creation @@ -64,3 +64,34 @@ CREATE TABLE "ulice_relation" ( FOREIGN KEY("company_id") REFERENCES "companies"("id"), FOREIGN KEY("ulice_id") REFERENCES "ulice"("id") ) + +CREATE TABLE "predmety_cinnosti_relation" ( + "company_id" INTEGER NOT NULL, + "predmet_cinnosti_id" INTEGER NOT NULL, + "zapis_datum" DATE, + "vymaz_datum" DATE, + FOREIGN KEY("company_id") REFERENCES "companies"("id"), + FOREIGN KEY("predmet_cinnosti_id") REFERENCES "predmety_cinnosti"("id") +) + +CREATE TABLE "predmety_podnikani_relation" ( + "company_id" INTEGER NOT NULL, + "predmet_podnikani_id" INTEGER NOT NULL, + "zapis_datum" DATE, + "vymaz_datum" DATE, + FOREIGN KEY("company_id") REFERENCES "companies"("id"), + FOREIGN KEY("predmet_podnikani_id") REFERENCES "predmety_podnikani"("id") +) + +CREATE TABLE "predmety_cinnosti" ( + "id" INTEGER NOT NULL, + "predmet_cinnosti" TEXT NOT NULL UNIQUE, + PRIMARY KEY("id" AUTOINCREMENT) +) + +CREATE TABLE "predmety_podnikani" ( + "id" INTEGER NOT NULL, + "predmet_podnikani" TEXT NOT NULL UNIQUE, + PRIMARY KEY("id" AUTOINCREMENT) +) + diff --git a/justice_main.py b/justice_main.py index 98b32af..9c09f62 100644 --- a/justice_main.py +++ b/justice_main.py @@ -47,9 +47,9 @@ def purge_DB(c): c.execute("DELETE FROM pravni_formy_relation")
c.execute("DELETE FROM insolvency_events")
c.execute("DELETE FROM predmety_podnikani")
- c.execute("DELETE FROM predemty_podnikani_relation")
+ c.execute("DELETE FROM predmety_podnikani_relation")
c.execute("DELETE FROM predmety_cinnosti")
- c.execute("DELETE FROM predemty_cinnosti_relation")
+ c.execute("DELETE FROM predmety_cinnosti_relation")
def find_other_properties(c, ICO, element, conn, primary_sql_key):
try:
@@ -79,7 +79,7 @@ def find_predmet_podnikani(c, ICO, predmet_podnikani_elem, conn, primary_sql_key zapis_datum = str(get_prop(elem2, ".//zapisDatum"))
vymaz_datum = str(get_prop(elem2, ".//vymazDatum"))
# hodnota_text = str(get_prop(elem2, ".//hodnotaText"))
- insert_instructions = [(".//hodnotaText","predmety_podnikani", "predmet_podnikani", "predemty_podnikani_relation")]
+ insert_instructions = [(".//hodnotaText","predmety_podnikani", "predmet_podnikani", "predmety_podnikani_relation")]
for elem in insert_instructions:
inserted_figure = str(get_prop(elem2, ".//hodnotaText"))
insert_into_ancillary_table(c, elem, inserted_figure)
@@ -97,7 +97,7 @@ def find_predmet_cinnosti(c, ICO, predmet_podnikani_elem, conn, primary_sql_key, zapis_datum = str(get_prop(elem2, ".//zapisDatum"))
vymaz_datum = str(get_prop(elem2, ".//vymazDatum"))
# hodnota_text = str(get_prop(elem2, ".//hodnotaText"))
- insert_instructions = [(".//hodnotaText","predmety_cinnosti", "predmet_cinnosti", "predemty_cinnosti_relation")]
+ insert_instructions = [(".//hodnotaText","predmety_cinnosti", "predmet_cinnosti", "predmety_cinnosti_relation")]
for elem in insert_instructions:
inserted_figure = str(get_prop(elem2, ".//hodnotaText"))
insert_into_ancillary_table(c, elem, inserted_figure)
|