Skip to content

Commit

Permalink
Added better logging in importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Hielke Kramer committed Oct 27, 2020
1 parent bba06b2 commit 95e2b28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions deploy/import/import.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh

set -e
set -u
set -u # crash on missing env variables
set -e # stop on any error
set -x # print what we are doing

DIR="$(dirname $0)"

Expand Down
11 changes: 8 additions & 3 deletions src/bouwdossiers/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ def import_pre_wabo_dossiers(max_file_count=None): # noqa C901
def add_bag_ids_to_wabo():
# This gets the nummeraanduidingen using the verblijfsobjecten instead of using the
# address as it is done in the pre-wabo dossiers.
log.info("Add nummeraanduidingen to wabo dossiers")
with connection.cursor() as cursor:
cursor.execute("""
WITH adres_nummeraanduiding AS (
Expand All @@ -434,10 +435,11 @@ def add_bag_ids_to_wabo():
FROM adres_nummeraanduiding
WHERE bouwdossiers_adres.id = adres_nummeraanduiding.id
""")
log.info("Finished adding nummeraanduidingen to wabo dossiers")


def add_bag_ids_to_pre_wabo():
log.info("Add nummeraanduidingen")
log.info("Add nummeraanduidingen to pre-wabo dossiers")
with connection.cursor() as cursor:
cursor.execute("""
WITH adres_nummeraanduiding AS (
Expand All @@ -459,7 +461,8 @@ def add_bag_ids_to_pre_wabo():
nummeraanduidingen_label = adres_nummeraanduiding.nummeraanduidingen_label
FROM adres_nummeraanduiding
WHERE bouwdossiers_adres.id = adres_nummeraanduiding.id
""")
""")
log.info("Finished adding nummeraanduidingen to pre-wabo dossiers")

log.info("Add panden")
with connection.cursor() as cursor:
Expand Down Expand Up @@ -487,7 +490,8 @@ def add_bag_ids_to_pre_wabo():
verblijfsobjecten_label = adres_pand.verblijfsobjecten_label
FROM adres_pand
WHERE bouwdossiers_adres.id = adres_pand.id
""")
""")
log.info("Finished adding panden")

# First we try to match with openbare ruimtes that are streets 01
log.info("Add openbare ruimtes")
Expand All @@ -510,6 +514,7 @@ def add_bag_ids_to_pre_wabo():
WHERE ba.straat = opr.naam
AND (ba.openbareruimte_id IS NULL OR ba.openbareruimte_id = '')
""")
log.info("Finished adding openbare ruimtes")


def validate_import(min_bouwdossiers_count):
Expand Down

0 comments on commit 95e2b28

Please sign in to comment.