diff --git a/CHANGES.txt b/CHANGES.txt index 1618589..42d65c7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,7 @@ Changes ======= -0.7.0 (2022-07-) +0.7.0 (2022-07-18) ------------------ - bcdata.define_request function renamed to define_requests, returns list of parsed urls rather than a list of request parameter dictionaries - this makes diff --git a/bcdata/__init__.py b/bcdata/__init__.py index d4d8a37..b5481e0 100644 --- a/bcdata/__init__.py +++ b/bcdata/__init__.py @@ -11,7 +11,7 @@ from .wcs import get_dem -__version__ = "0.7.0dev0" +__version__ = "0.7.0" BCDC_API_URL = "https://catalogue.data.gov.bc.ca/api/3/action/" WFS_URL = "https://openmaps.gov.bc.ca/geo/pub/wfs" diff --git a/bcdata/database.py b/bcdata/database.py index cf42f57..4989b87 100644 --- a/bcdata/database.py +++ b/bcdata/database.py @@ -159,12 +159,17 @@ def define_table( schema=schema_name, ) - # if append not noted, drop any existing table and create the new table - if not append: - if schema_name not in self.schemas: - self.create_schema(schema_name) - if schema_name + "." + table_name in self.tables: - self.drop_table(schema_name, table_name) + if schema_name not in self.schemas: + self.create_schema(schema_name) + + # drop existing table if append is not flagged + if schema_name + "." + table_name in self.tables and not append: + log.info("Table {schema_name}.{table_name} exists, overwriting") + self.drop_table(schema_name, table_name) + + # create the table + if schema_name + "." + table_name not in self.tables: + log.info("Creating table {schema_name}.{table_name}") table.create() return table