def test_create_database(): settings = SettingsObject(INI_ABSPATH) try: drop_database(settings) except Exception: pass create_database(settings)
def setUpClass(cls): cls.settings = SettingsObject(INI_ABSPATH) try: drop_database(cls.settings) except Exception: pass create_database(cls.settings) cls.db = ThreediDatabase(cls.settings) cls.db.create_extension(extension_name="postgis") cls.db.initialize_db_threedi() cls.db.create_schema("src")
def run_scripts(settings): """ background program for running all functionalities """ # block with only server connection if settings.dropdb: print("Drop the Citybuilder database") logger.info("Drop the Citybuilder database") drop_database(settings) logger.info("Completed - Drop the Citybuilder database") if settings.createdb: print("Create the Citybuilder database") logger.info("Create the Citybuilder database") create_database(settings) logger.info("Completed - Create the Citybuilder database") # block with database connection if settings.createdb or settings.import_type or settings.checks or settings.emptydb: db = ThreediDatabase(settings) if settings.createdb: print("Initialize the Citybuilder database") logger.info("Initialize the Citybuilder database") db.initialize_db_threedi() logger.info("Completed - Initialize the Citybuilder database") if settings.emptydb: logger.info("Empty the Citybuilder database") db.empty_database() logger.info("Completed - Empty the Citybuilder database") if settings.import_type: print("import") logger.info("Import your sewerage data of %s" % settings.import_type) import_sewerage_data_into_db(db, settings) logger.info("Completed - Import your sewerage data of %s" % settings.import_type) if settings.checks: print("checks") logger.info("Check your sewerage system") check_sewerage(db, settings) logger.info("Completed - Check your sewerage system") if settings.export: print("export") logger.info("Export database to geopackage") export_checks_from_db_to_gpkg(settings) logger.info("Completed - Export database to geopackage") return True
def setUpClass(cls): cls.settings = SettingsObject(INI_ABSPATH) try: drop_database(cls.settings) except Exception: pass create_database(cls.settings) cls.db = ThreediDatabase(cls.settings) cls.db.create_extension(extension_name="postgis") cls.db.initialize_db_threedi() # load GBI manholes only into tester manhole_layer_rel_path = "data/schiedam-test/schiedam-putten-test.shp" cls.settings.manhole_layer = os.path.join(OUR_DIR, manhole_layer_rel_path) cls.settings.import_type = "gbi" import_sewerage_data_into_db(cls.db, cls.settings)
def setUpClass(cls): cls.settings = SettingsObject(INI_ABSPATH) try: drop_database(cls.settings) except Exception: pass create_database(cls.settings) cls.db = ThreediDatabase(cls.settings) cls.db.create_extension(extension_name="postgis") cls.db.initialize_db_threedi() cls.db.create_schema("src") # Create geopackage datasource if os.path.isfile(GKPG_ABSPATH): os.remove(GKPG_ABSPATH) cls.gpkg_source = None cls.gpkg_source = DRIVER_OGR_GPKG.CreateDataSource(GKPG_ABSPATH) cls.gpkg_source = set_ogr_connection(GKPG_ABSPATH)
def setUpClass(cls): cls.settings = SettingsObject(INI_ABSPATH) create_database(cls.settings) cls.db = ThreediDatabase(cls.settings) cls.db.create_extension(extension_name="postgis") cls.db.initialize_db_threedi()
def setUpClass(cls): cls.settings = SettingsObject(INI_ABSPATH) create_database(cls.settings) cls.db = ThreediDatabase(cls.settings)
def test_init_threedidatabase(): settings = SettingsObject(INI_ABSPATH) create_database(settings) ThreediDatabase(settings) drop_database(settings)