Skip to content

Commit

Permalink
Issue153 (#154)
Browse files Browse the repository at this point in the history
* fix #153

* note fix
  • Loading branch information
smnorris committed Dec 30, 2023
1 parent dc11f40 commit c6a65b8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changes
=======

0.9.1 ()
------------------
- fix problem with multiple-resource bcdc packages (#153)

0.9.0 (2023-11-17)
------------------
- use default pagesize provided by server and remove pagesize option from all functions and commands (#90)
Expand Down
29 changes: 19 additions & 10 deletions bcdata/bcdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,25 @@ def get_table_definition(table_name):
# multiple format resource
elif resource["format"] == "multiple":
# if multiple format, check for table name match in this location
if json.loads(resource["preview_info"])["layer_name"] == table_name:
if "object_table_comments" in resource.keys():
table_comments = resource["object_table_comments"]
else:
table_comments = None
# only add to matches if schema details found
if "details" in resource.keys() and resource["details"] != "":
table_details = resource["details"]
matches.append((notes, table_comments, table_details))
log.debug(resource)
if resource[
"preview_info"
]: # first check that the key is not empty
if (
json.loads(resource["preview_info"])["layer_name"]
== table_name
):
if "object_table_comments" in resource.keys():
table_comments = resource["object_table_comments"]
else:
table_comments = None
# only add to matches if schema details found
if (
"details" in resource.keys()
and resource["details"] != ""
):
table_details = resource["details"]
matches.append((notes, table_comments, table_details))
log.debug(resource)

# uniquify the result
if len(matches) > 0:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_bcdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ def test_get_table_definition_format_multi():
assert table_definition["description"]
assert table_definition["comments"]
assert table_definition["schema"]


def test_get_table_definition_format_multi_nopreview():
table_definition = bcdc.get_table_definition(
"WHSE_BASEMAPPING.FWA_NAMED_POINT_FEATURES_SP"
)
assert table_definition["description"]
assert table_definition["comments"]
assert table_definition["schema"]

0 comments on commit c6a65b8

Please sign in to comment.