cloe-nessy 0.3.11.3b0__py3-none-any.whl → 0.3.11.5b0__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.
- cloe_nessy/models/table.py +6 -37
- cloe_nessy/models/volume.py +2 -32
- {cloe_nessy-0.3.11.3b0.dist-info → cloe_nessy-0.3.11.5b0.dist-info}/METADATA +1 -1
- {cloe_nessy-0.3.11.3b0.dist-info → cloe_nessy-0.3.11.5b0.dist-info}/RECORD +6 -6
- {cloe_nessy-0.3.11.3b0.dist-info → cloe_nessy-0.3.11.5b0.dist-info}/WHEEL +0 -0
- {cloe_nessy-0.3.11.3b0.dist-info → cloe_nessy-0.3.11.5b0.dist-info}/top_level.txt +0 -0
cloe_nessy/models/table.py
CHANGED
|
@@ -12,16 +12,6 @@ from pydantic import (
|
|
|
12
12
|
model_validator,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
try:
|
|
16
|
-
from importlib.resources import files # type: ignore[attr-defined]
|
|
17
|
-
except ImportError:
|
|
18
|
-
try:
|
|
19
|
-
from importlib_resources import files as importlib_resources_files # type: ignore[import-untyped]
|
|
20
|
-
|
|
21
|
-
files = importlib_resources_files
|
|
22
|
-
except ImportError:
|
|
23
|
-
files = None # type: ignore[assignment]
|
|
24
|
-
|
|
25
15
|
from ..logging import LoggerMixin
|
|
26
16
|
from ..utils.file_and_directory_handler import process_path
|
|
27
17
|
from .column import Column
|
|
@@ -257,35 +247,14 @@ class Table(TemplateLoaderMixin, ReadInstancesMixin, LoggerMixin):
|
|
|
257
247
|
Raises:
|
|
258
248
|
TemplateNotFound: If the template file is not found.
|
|
259
249
|
"""
|
|
250
|
+
templates = Path(__file__).parent / "templates"
|
|
260
251
|
template_name = "create_table.sql.j2"
|
|
261
|
-
template = None
|
|
262
|
-
|
|
263
|
-
# Approach 1: Try importlib.resources (recommended for Python 3.9+)
|
|
264
|
-
if files is not None:
|
|
265
|
-
try:
|
|
266
|
-
template_files = files("cloe_nessy.models") / "templates"
|
|
267
|
-
template_content = (template_files / template_name).read_text()
|
|
268
|
-
|
|
269
|
-
from jinja2 import BaseLoader, Environment
|
|
270
|
-
|
|
271
|
-
env = Environment(loader=BaseLoader(), keep_trailing_newline=True)
|
|
272
|
-
template = env.from_string(template_content)
|
|
273
|
-
|
|
274
|
-
except (FileNotFoundError, AttributeError, ImportError):
|
|
275
|
-
pass # Try next approach
|
|
276
|
-
|
|
277
|
-
# Approach 2: Try relative to __file__ (development/editable install)
|
|
278
|
-
if template is None:
|
|
279
|
-
try:
|
|
280
|
-
templates = Path(__file__).parent / "templates"
|
|
281
|
-
template = self.get_template(templates, template_name)
|
|
282
|
-
except TemplateNotFound:
|
|
283
|
-
pass # Try next approach
|
|
284
|
-
|
|
285
|
-
if template is None:
|
|
286
|
-
self._console_logger.error(f"Template [ {template_name} ] not found in any location.")
|
|
287
|
-
raise TemplateNotFound(template_name)
|
|
288
252
|
|
|
253
|
+
try:
|
|
254
|
+
template = self.get_template(templates, template_name)
|
|
255
|
+
except TemplateNotFound as err:
|
|
256
|
+
self._console_logger.error(f"Template [ {template_name} ] not found.")
|
|
257
|
+
raise err
|
|
289
258
|
render = template.render(table=self, replace=replace)
|
|
290
259
|
return render
|
|
291
260
|
|
cloe_nessy/models/volume.py
CHANGED
|
@@ -4,16 +4,6 @@ from typing import Any
|
|
|
4
4
|
from jinja2 import TemplateNotFound
|
|
5
5
|
from pydantic import BaseModel, field_validator
|
|
6
6
|
|
|
7
|
-
try:
|
|
8
|
-
from importlib.resources import files # type: ignore[attr-defined]
|
|
9
|
-
except ImportError:
|
|
10
|
-
try:
|
|
11
|
-
from importlib_resources import files as importlib_resources_files # type: ignore[import-untyped]
|
|
12
|
-
|
|
13
|
-
files = importlib_resources_files
|
|
14
|
-
except ImportError:
|
|
15
|
-
files = None # type: ignore[assignment]
|
|
16
|
-
|
|
17
7
|
from ..logging import LoggerMixin
|
|
18
8
|
from .mixins.template_loader_mixin import TemplateLoaderMixin
|
|
19
9
|
|
|
@@ -75,29 +65,9 @@ class Volume(TemplateLoaderMixin, LoggerMixin, BaseModel):
|
|
|
75
65
|
The rendered create statement as a string.
|
|
76
66
|
"""
|
|
77
67
|
template_name = "create_volume.sql.j2"
|
|
78
|
-
template = None
|
|
79
|
-
|
|
80
|
-
# Approach 1: Try importlib.resources (recommended for Python 3.9+)
|
|
81
|
-
if files is not None:
|
|
82
|
-
try:
|
|
83
|
-
template_files = files("cloe_nessy.models") / "templates"
|
|
84
|
-
template_content = (template_files / template_name).read_text()
|
|
85
|
-
|
|
86
|
-
from jinja2 import BaseLoader, Environment
|
|
87
68
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
except (FileNotFoundError, AttributeError, ImportError):
|
|
92
|
-
pass # Try next approach
|
|
93
|
-
|
|
94
|
-
# Approach 2: Try relative to __file__ (development/editable install)
|
|
95
|
-
if template is None:
|
|
96
|
-
try:
|
|
97
|
-
templates = Path(__file__).parent / "templates"
|
|
98
|
-
template = self.get_template(templates, template_name)
|
|
99
|
-
except TemplateNotFound:
|
|
100
|
-
pass # Try next approach
|
|
69
|
+
templates = Path(__file__).parent / "templates"
|
|
70
|
+
template = self.get_template(templates, template_name)
|
|
101
71
|
|
|
102
72
|
if template is None:
|
|
103
73
|
self._console_logger.error(f"Template [ {template_name} ] not found in any location.")
|
|
@@ -42,9 +42,9 @@ cloe_nessy/models/column.py,sha256=53fBwRnino72XKACsHZpN9QfCBqqSXyKLHZlM0huumg,1
|
|
|
42
42
|
cloe_nessy/models/constraint.py,sha256=hsFlhn4n928z81O3dl3v5bMetewPWzMjkJK3_4kASSM,178
|
|
43
43
|
cloe_nessy/models/foreign_key.py,sha256=DwRVHs9sShqqPV-NL7ow_3AmPPWX0Od26yZn_I565pU,1001
|
|
44
44
|
cloe_nessy/models/schema.py,sha256=yUrjjEhAH5zbCymE67Az_jPnVB8hGO-_UNfqzeZCD_Y,3376
|
|
45
|
-
cloe_nessy/models/table.py,sha256=
|
|
45
|
+
cloe_nessy/models/table.py,sha256=O9vcJ1XBIb6kA-NAI3SNpB5b7MGDo3p4wMJdonPaBfA,12076
|
|
46
46
|
cloe_nessy/models/types.py,sha256=XRbuJGdTNa6aXyE3IAzs_J9gVjbfkzMDLfGl-k6jI_4,223
|
|
47
|
-
cloe_nessy/models/volume.py,sha256=
|
|
47
|
+
cloe_nessy/models/volume.py,sha256=T1tw08OohuFkSaAA-ToI7Gogm5dY-JZTyeZYJyc5Qks,2457
|
|
48
48
|
cloe_nessy/models/adapter/__init__.py,sha256=m36W_mqwB3dCYnCIt0fLOSHS4E1VU8FRGoaum4Gf95o,90
|
|
49
49
|
cloe_nessy/models/adapter/unity_catalog_adapter.py,sha256=a-14Ys-AevVYQd0xeJU1syLxjT5Wzo4uog1hFSEs76M,12651
|
|
50
50
|
cloe_nessy/models/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -94,7 +94,7 @@ cloe_nessy/settings/__init__.py,sha256=ZbkneO3WaKOxon7qHFHnou7EnBOSnBFyKMDZblIEv
|
|
|
94
94
|
cloe_nessy/settings/settings.py,sha256=I4n129lrujriW-d8q4as2Kb4_kI932ModfZ5Ow_UpVM,3653
|
|
95
95
|
cloe_nessy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
96
|
cloe_nessy/utils/file_and_directory_handler.py,sha256=r2EVt9xG81p6ScaJCwETC5an6pMT6WseB0jMOR-JlpU,602
|
|
97
|
-
cloe_nessy-0.3.11.
|
|
98
|
-
cloe_nessy-0.3.11.
|
|
99
|
-
cloe_nessy-0.3.11.
|
|
100
|
-
cloe_nessy-0.3.11.
|
|
97
|
+
cloe_nessy-0.3.11.5b0.dist-info/METADATA,sha256=ujLV1H3c4aLGooIc3Bmz0uLRsAS6p8eacVwCY3ZGwPw,3166
|
|
98
|
+
cloe_nessy-0.3.11.5b0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
99
|
+
cloe_nessy-0.3.11.5b0.dist-info/top_level.txt,sha256=Z7izn8HmQpg2wBUb-0jzaKlYKMU7Ypzuc9__9vPtW_I,11
|
|
100
|
+
cloe_nessy-0.3.11.5b0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|