Skip to content

Commit

Permalink
schema: Add a special dir away from the data to do schema things
Browse files Browse the repository at this point in the history
Avoid a potential clash of schema data vs grant data if file names were
the same. Also remove redundant comment about 1.4 release. This has
happened now.
  • Loading branch information
michaelwood committed Apr 4, 2024
1 parent af55da5 commit 5936012
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib360dataquality/cove/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,23 @@ class Schema360(SchemaJsonMixin):
schema_name = config["schema_item_name"]
pkg_schema_name = config["schema_name"]
pkg_schema_url = "" # required by libcove but not in use
schema_host = "" # required by libcove but not in use
extended = False # required by libcove but not in use
extension_codelist_urls = []

_pkg_schema_obj = {}
_schema_obj = {}

def __init__(self, working_dir) -> None:
self.working_dir = working_dir
def __init__(self, data_dir) -> None:
# Create dedicated location for schema work
self.working_dir = os.path.join(data_dir, "schema")
try:
os.mkdir(self.working_dir)
except FileExistsError:
pass

self.schema_host = self.working_dir # required by lib-cove
# required by lib-cove for CustomRefResolver the trailing / is needed to make sure
# urljoin does not discard the final part of the location.
self.schema_host = f"{self.working_dir}/"

schema_url = urljoin(config["schema_host"], self.schema_name)
pkg_schema_url = urljoin(config["schema_host"], self.pkg_schema_name)
Expand Down Expand Up @@ -131,8 +137,6 @@ def resolve_extension(self, json_data) -> Optional[list]:
Returns an array of extension_infos or None
"""

# FIXME NOTE this currently requires env SCHEMA_BRANCH=1.4-staging

try:
extension_ids = json_data["extensions"]
except KeyError:
Expand Down

0 comments on commit 5936012

Please sign in to comment.