bcdata 0.12.1__tar.gz → 0.12.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {bcdata-0.12.1 → bcdata-0.12.2}/CHANGES.txt +4 -0
  2. {bcdata-0.12.1/bcdata.egg-info → bcdata-0.12.2}/PKG-INFO +1 -1
  3. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/__init__.py +1 -1
  4. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/bcdc.py +17 -8
  5. {bcdata-0.12.1 → bcdata-0.12.2/bcdata.egg-info}/PKG-INFO +1 -1
  6. {bcdata-0.12.1 → bcdata-0.12.2}/tests/test_bcdc.py +8 -0
  7. {bcdata-0.12.1 → bcdata-0.12.2}/LICENSE.txt +0 -0
  8. {bcdata-0.12.1 → bcdata-0.12.2}/README.md +0 -0
  9. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/bc2pg.py +0 -0
  10. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/cli.py +0 -0
  11. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/database.py +0 -0
  12. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/wcs.py +0 -0
  13. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata/wfs.py +0 -0
  14. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata.egg-info/SOURCES.txt +0 -0
  15. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata.egg-info/dependency_links.txt +0 -0
  16. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata.egg-info/entry_points.txt +0 -0
  17. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata.egg-info/not-zip-safe +0 -0
  18. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata.egg-info/requires.txt +0 -0
  19. {bcdata-0.12.1 → bcdata-0.12.2}/bcdata.egg-info/top_level.txt +0 -0
  20. {bcdata-0.12.1 → bcdata-0.12.2}/pyproject.toml +0 -0
  21. {bcdata-0.12.1 → bcdata-0.12.2}/requirements.txt +0 -0
  22. {bcdata-0.12.1 → bcdata-0.12.2}/setup.cfg +0 -0
  23. {bcdata-0.12.1 → bcdata-0.12.2}/setup.py +0 -0
  24. {bcdata-0.12.1 → bcdata-0.12.2}/tests/test_bc2pg.py +0 -0
  25. {bcdata-0.12.1 → bcdata-0.12.2}/tests/test_cli.py +0 -0
  26. {bcdata-0.12.1 → bcdata-0.12.2}/tests/test_wcs.py +0 -0
  27. {bcdata-0.12.1 → bcdata-0.12.2}/tests/test_wfs.py +0 -0
@@ -1,6 +1,10 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ 0.12.2 (2024-08-15)
5
+ ------------------
6
+ - fix error where incorrect schema returned for datasets with multiple resources (#196)
7
+
4
8
  0.12.1 (2024-08-15)
5
9
  ------------------
6
10
  - fix syntax error
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcdata
3
- Version: 0.12.1
3
+ Version: 0.12.2
4
4
  Summary: Python tools for quick access to DataBC geo-data available via WFS
5
5
  Home-page: https://github.com/smnorris/bcdata
6
6
  Author: Simon Norris
@@ -27,4 +27,4 @@ else:
27
27
  raise Exception(f"Failed to download primary key database at {PRIMARY_KEY_DB_URL}")
28
28
  primary_keys = {}
29
29
 
30
- __version__ = "0.12.1"
30
+ __version__ = "0.12.2"
@@ -104,14 +104,23 @@ def get_table_definition(table_name):
104
104
  table_definition["description"] = result["notes"]
105
105
  # iterate through resources associated with each package
106
106
  for resource in result["resources"]:
107
- # presume description and details are the same for all resources
108
- # (below only retains the final schema/comments if there is more than one
109
- # package with this information)
110
- if "details" in resource.keys() and resource["details"] != "":
111
- table_definition["schema"] = json.loads(resource["details"])
112
- # look for comments only if details/schema is present
113
- if "object_table_comments" in resource.keys():
114
- table_definition["comments"] = resource["object_table_comments"]
107
+ # only examine geographic resources with object name key
108
+ if (
109
+ "object_name" in resource.keys()
110
+ and resource["bcdc_type"] == "geographic"
111
+ ):
112
+ # confirm that object name matches table name and schema is present
113
+ if (
114
+ resource["object_name"] == table_name
115
+ and "details" in resource.keys()
116
+ and resource["details"] != ""
117
+ ):
118
+ table_definition["schema"] = json.loads(resource["details"])
119
+ # look for comments only if details/schema was found
120
+ if "object_table_comments" in resource.keys():
121
+ table_definition["comments"] = resource[
122
+ "object_table_comments"
123
+ ]
115
124
 
116
125
  if not table_definition["schema"]:
117
126
  log.warning(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcdata
3
- Version: 0.12.1
3
+ Version: 0.12.2
4
4
  Summary: Python tools for quick access to DataBC geo-data available via WFS
5
5
  Home-page: https://github.com/smnorris/bcdata
6
6
  Author: Simon Norris
@@ -2,6 +2,7 @@ import json
2
2
 
3
3
  import pytest
4
4
 
5
+ import bcdata
5
6
  from bcdata import bcdc
6
7
 
7
8
  AIRPORTS_PACKAGE = "bc-airports"
@@ -40,6 +41,13 @@ def test_get_table_definition_format_multi():
40
41
  assert table_definition["description"]
41
42
  assert table_definition["comments"]
42
43
  assert table_definition["schema"]
44
+ columns = [c["column_name"] for c in table_definition["schema"]]
45
+ assert (
46
+ bcdata.primary_keys[
47
+ "whse_forest_vegetation.ogsr_priority_def_area_cur_sp"
48
+ ].upper()
49
+ in columns
50
+ )
43
51
 
44
52
 
45
53
  def test_get_table_definition_format_multi_nopreview():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes