thds.tabularasa 0.14.1__py3-none-any.whl → 0.14.3__py3-none-any.whl

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.
@@ -1,5 +1,4 @@
1
1
  import logging
2
- import os
3
2
  import shutil
4
3
  import subprocess
5
4
  import sys
@@ -14,7 +13,7 @@ from typing import Dict, Iterable, Iterator, List, NamedTuple, Optional, Set, Tu
14
13
  import networkx as nx
15
14
  import pkg_resources
16
15
 
17
- from thds.core import parallel
16
+ from thds.core import link, parallel
18
17
  from thds.tabularasa.data_dependencies.adls import (
19
18
  ADLSFileIntegrityError,
20
19
  ADLSFileSystem,
@@ -730,7 +729,7 @@ class ReferenceDataManager:
730
729
  file_path = self.data_path_for(table)
731
730
  if file_path.exists():
732
731
  self.logger.warning(f"Removing built file for table {table.name} at {file_path}")
733
- os.remove(file_path)
732
+ file_path.unlink()
734
733
  else:
735
734
  self.logger.info(f"No file found for table {table.name}; nothing to remove")
736
735
  try:
@@ -763,7 +762,7 @@ class ReferenceDataManager:
763
762
  for table in tables_to_update:
764
763
  table_name = table.name
765
764
  table_path = self.data_path_for(table)
766
- if os.path.exists(table_path):
765
+ if table_path.exists():
767
766
  md5 = hash_file(table_path)
768
767
  old_md5 = table.md5
769
768
  if old_md5 is None:
@@ -847,10 +846,10 @@ class ReferenceDataManager:
847
846
  local_cache_path = paths[0].local_path
848
847
  if sync_data.local_file_exists:
849
848
  self.logger.warning(f"Removing existing file {sync_data.local_path}")
850
- os.remove(sync_data.local_path)
849
+ sync_data.local_path.unlink()
851
850
  self.logger.info(f"Linking downloaded file to local build file {sync_data.local_path}")
852
851
  sync_data.local_path.parent.mkdir(parents=True, exist_ok=True)
853
- os.link(local_cache_path, sync_data.local_path)
852
+ link.link(local_cache_path, sync_data.local_path)
854
853
  return True
855
854
 
856
855
  def sync_blob_store(
@@ -184,6 +184,7 @@ def bulk_write_connection(
184
184
  db_path_ = to_local_path(db_path, db_package).absolute()
185
185
  lock_path = db_path_.with_suffix(".lock")
186
186
  lock = FileLock(lock_path)
187
+ lock_path.parent.mkdir(parents=True, exist_ok=True)
187
188
  logger = logging.getLogger(__name__)
188
189
  logger.info("PID %d: Acquiring lock on %s", os.getpid(), lock_path)
189
190
  with lock:
@@ -207,7 +208,7 @@ def sqlite_connection(
207
208
  *,
208
209
  mmap_size: Optional[int] = None,
209
210
  read_only: bool = False,
210
- ):
211
+ ) -> sqlite3.Connection:
211
212
  db_full_path = to_local_path(db_path, package)
212
213
 
213
214
  logger = logging.getLogger(__name__)
@@ -225,7 +226,7 @@ def sqlite_connection(
225
226
 
226
227
  def _log_exec_sql(
227
228
  logger: logging.Logger, con: sqlite3.Connection, statement: str, level: int = logging.DEBUG
228
- ):
229
+ ) -> None:
229
230
  logger.log(level, "sqlite: %s", statement)
230
231
  con.execute(statement)
231
232
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thds.tabularasa
3
- Version: 0.14.1
3
+ Version: 0.14.3
4
4
  Summary: Trilliant Health reference data build system.
5
5
  Author-email: Trilliant Health <info@trillianthealth.com>
6
6
  Project-URL: Repository, https://github.com/TrilliantHealth/ds-monorepo
@@ -1,5 +1,5 @@
1
1
  thds/tabularasa/__init__.py,sha256=jc6w1WD868MQ2t4wkRNYvRssojwXvPDcNyC8V5gwbl0,169
2
- thds/tabularasa/__main__.py,sha256=Ryfd7YogTE_qFjp8IJA-KTeTXXD9INS5GJGmdPVvWBw,47791
2
+ thds/tabularasa/__main__.py,sha256=DlaUfXu03tbBVucRuMw7354LeBs8d5tRCuAprZs0XYs,47778
3
3
  thds/tabularasa/compat.py,sha256=j0313TPIXtkbfvRI0AH4if8GLrjQSrDJ9heayCIl9w8,1037
4
4
  thds/tabularasa/git_util.py,sha256=fBFhaCPi_5W2BpG2B3WiPcAWJvuVI_pG47rt73wLO6E,1388
5
5
  thds/tabularasa/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,7 +19,7 @@ thds/tabularasa/diff/summary.py,sha256=gENtDwhSrDYeN-8fWr6Ug2zgdp584b0pZF9UBYzKF
19
19
  thds/tabularasa/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  thds/tabularasa/loaders/lazy_adls.py,sha256=jrWy5tTKDQfWEv6aHQ3UJhFzLrDPOlSGsArv9zcl1g8,1375
21
21
  thds/tabularasa/loaders/parquet_util.py,sha256=u75j3PkMSakO2zfq4zksWzXLYnaO--WizAgXTcSpXRY,13354
22
- thds/tabularasa/loaders/sqlite_util.py,sha256=3Gi1Y4iTVCD9FXqylQw1eyFwVuplQUrjY1J0SC5FFWg,11099
22
+ thds/tabularasa/loaders/sqlite_util.py,sha256=etLiV0h1l7NQHaEdNjz0QtqYaRBSm5L6EVWOwnCRv2w,11185
23
23
  thds/tabularasa/loaders/util.py,sha256=XmsGkDdL6O8R6B4667Iqi5HoRgq0YMs6LP3VvPIqPVU,21369
24
24
  thds/tabularasa/schema/__init__.py,sha256=bowvNXrrDrWB3TAmwDxCeEAvVEe9z7iRfqRaNg1Qmo4,440
25
25
  thds/tabularasa/schema/constraints.py,sha256=V2vh01BhYR8OVQvgdujqSi0l_fMJvFKYSlBvWExZFG0,9744
@@ -41,8 +41,8 @@ thds/tabularasa/schema/compilation/sqlite.py,sha256=wSrSlVCYeuTpOf9AOHAnp6gJHkjH
41
41
  thds/tabularasa/schema/compilation/util.py,sha256=YXFe1_yoBobED010hstKIoq-dwLHo6SBv1v1IAw6AYU,3886
42
42
  thds/tabularasa/testing/__init__.py,sha256=XoLzB-DotxFw9KHt2vfH72k7pyAAFI2bW-qqq6nww1g,85
43
43
  thds/tabularasa/testing/mock_sqlite.py,sha256=xoV4w_GaDgtZf17iUux2-LA6Va1XRJdC2FU34dysh0o,4769
44
- thds_tabularasa-0.14.1.dist-info/METADATA,sha256=rqg7l_iBlrh7E8-iXCeZyLcnOxJIuFDBw_5QNe1A9V0,26786
45
- thds_tabularasa-0.14.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- thds_tabularasa-0.14.1.dist-info/entry_points.txt,sha256=PX4ShRonjv6lMsVjrGu8RkFzpyyvgM9EnZlNfMomd9k,61
47
- thds_tabularasa-0.14.1.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
48
- thds_tabularasa-0.14.1.dist-info/RECORD,,
44
+ thds_tabularasa-0.14.3.dist-info/METADATA,sha256=WfrgVRGa1Te2GYA4qFHRogd9-H8ZPJRsTNVOwhKbL1Q,26786
45
+ thds_tabularasa-0.14.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ thds_tabularasa-0.14.3.dist-info/entry_points.txt,sha256=PX4ShRonjv6lMsVjrGu8RkFzpyyvgM9EnZlNfMomd9k,61
47
+ thds_tabularasa-0.14.3.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
48
+ thds_tabularasa-0.14.3.dist-info/RECORD,,