liminal-orm 1.1.0__py3-none-any.whl → 1.1.2__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.
- liminal/entity_schemas/generate_files.py +0 -1
- liminal/entity_schemas/operations.py +1 -1
- liminal/orm/column.py +9 -2
- liminal/tests/conftest.py +32 -0
- liminal/tests/test_entity_schema_compare.py +11 -0
- {liminal_orm-1.1.0.dist-info → liminal_orm-1.1.2.dist-info}/METADATA +3 -1
- {liminal_orm-1.1.0.dist-info → liminal_orm-1.1.2.dist-info}/RECORD +10 -10
- {liminal_orm-1.1.0.dist-info → liminal_orm-1.1.2.dist-info}/WHEEL +1 -1
- {liminal_orm-1.1.0.dist-info → liminal_orm-1.1.2.dist-info}/LICENSE.md +0 -0
- {liminal_orm-1.1.0.dist-info → liminal_orm-1.1.2.dist-info}/entry_points.txt +0 -0
@@ -74,7 +74,6 @@ def generate_all_entity_schema_files(
|
|
74
74
|
columns = {key: columns[key] for key in columns}
|
75
75
|
import_strings = [
|
76
76
|
"from sqlalchemy import Column as SqlColumn",
|
77
|
-
"from sqlalchemy.orm import Query, Session",
|
78
77
|
"from liminal.orm.column import Column",
|
79
78
|
"from liminal.orm.base_model import BaseModel",
|
80
79
|
"from liminal.orm.schema_properties import SchemaProperties",
|
liminal/orm/column.py
CHANGED
@@ -26,12 +26,16 @@ class Column(SqlColumn):
|
|
26
26
|
Whether the field is a multi-value field.
|
27
27
|
parent_link : bool = False
|
28
28
|
Whether the entity link field is a parent of the entity schema.
|
29
|
+
tooltip : str | None = None
|
30
|
+
The tooltip text for the field.
|
29
31
|
dropdown : Type[BaseDropdown] | None = None
|
30
32
|
The dropdown for the field.
|
31
33
|
entity_link : str | None = None
|
32
34
|
The warehouse name of the entity the field links to.
|
33
|
-
|
34
|
-
The
|
35
|
+
_warehouse_name : str | None = None
|
36
|
+
The warehouse name of the column. Necessary when the variable name is not the same as the warehouse name.
|
37
|
+
_archived : bool = False
|
38
|
+
Whether the field is archived.
|
35
39
|
"""
|
36
40
|
|
37
41
|
def __init__(
|
@@ -44,6 +48,7 @@ class Column(SqlColumn):
|
|
44
48
|
tooltip: str | None = None,
|
45
49
|
dropdown: Type[BaseDropdown] | None = None, # noqa: UP006
|
46
50
|
entity_link: str | None = None,
|
51
|
+
_warehouse_name: str | None = None,
|
47
52
|
_archived: bool = False,
|
48
53
|
**kwargs: Any,
|
49
54
|
):
|
@@ -82,6 +87,8 @@ class Column(SqlColumn):
|
|
82
87
|
foreign_key = None
|
83
88
|
if type == BenchlingFieldType.ENTITY_LINK and entity_link:
|
84
89
|
foreign_key = ForeignKey(f"{entity_link}$raw.id")
|
90
|
+
if _warehouse_name:
|
91
|
+
kwargs["name"] = _warehouse_name
|
85
92
|
super().__init__(
|
86
93
|
self.sqlalchemy_type,
|
87
94
|
foreign_key,
|
liminal/tests/conftest.py
CHANGED
@@ -215,6 +215,24 @@ def mock_benchling_schema(
|
|
215
215
|
tooltip=None,
|
216
216
|
_archived=False,
|
217
217
|
),
|
218
|
+
"archived_field": Props(
|
219
|
+
name="Archived Field",
|
220
|
+
type=Type.TEXT,
|
221
|
+
required=False,
|
222
|
+
is_multi=False,
|
223
|
+
_archived=True,
|
224
|
+
),
|
225
|
+
"wh_name_field_different": Props(
|
226
|
+
name="Different Wh Name Field",
|
227
|
+
type=Type.TEXT,
|
228
|
+
required=False,
|
229
|
+
is_multi=False,
|
230
|
+
parent_link=False,
|
231
|
+
dropdown_link=None,
|
232
|
+
entity_link=None,
|
233
|
+
tooltip=None,
|
234
|
+
_archived=False,
|
235
|
+
),
|
218
236
|
}
|
219
237
|
return [(schema_props, fields)]
|
220
238
|
|
@@ -369,6 +387,20 @@ def mock_benchling_subclass(mock_benchling_dropdown) -> list[type[BaseModel]]:
|
|
369
387
|
is_multi=True,
|
370
388
|
dropdown=mock_benchling_dropdown,
|
371
389
|
)
|
390
|
+
archived_field: SqlColumn = Column(
|
391
|
+
name="Archived Field",
|
392
|
+
type=Type.TEXT,
|
393
|
+
required=False,
|
394
|
+
is_multi=False,
|
395
|
+
_archived=True,
|
396
|
+
)
|
397
|
+
different_wh_name_field: SqlColumn = Column(
|
398
|
+
name="Different Wh Name Field",
|
399
|
+
type=Type.TEXT,
|
400
|
+
required=False,
|
401
|
+
is_multi=False,
|
402
|
+
_warehouse_name="wh_name_field_different",
|
403
|
+
)
|
372
404
|
|
373
405
|
def __init__(
|
374
406
|
self,
|
@@ -330,3 +330,14 @@ class TestCompareEntitySchemas:
|
|
330
330
|
assert isinstance(
|
331
331
|
invalid_models["mock_entity"][0].op, ReorderEntitySchemaFields
|
332
332
|
)
|
333
|
+
|
334
|
+
# Test when the Benchling schema archived field becomes unarchived
|
335
|
+
benchling_rearchived_field = copy.deepcopy(mock_benchling_schema)
|
336
|
+
benchling_rearchived_field[0][1]["archived_field"].set_archived(False)
|
337
|
+
mock_get_benchling_entity_schemas.return_value = benchling_rearchived_field
|
338
|
+
invalid_models = compare_entity_schemas(mock_benchling_sdk)
|
339
|
+
assert len(invalid_models["mock_entity"]) == 1
|
340
|
+
assert isinstance(
|
341
|
+
invalid_models["mock_entity"][0].op, ArchiveEntitySchemaField
|
342
|
+
)
|
343
|
+
assert invalid_models["mock_entity"][0].op.wh_field_name == "archived_field"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: liminal-orm
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.2
|
4
4
|
Summary: An ORM and toolkit that builds on top of Benchling's platform to keep your schemas and downstream code dependencies in sync.
|
5
5
|
Home-page: https://github.com/dynotx/liminal-orm
|
6
6
|
Author: DynoTx Open Source
|
@@ -10,6 +10,8 @@ Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.9
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
13
15
|
Requires-Dist: benchling-sdk (>=1.8.0)
|
14
16
|
Requires-Dist: bs4 (>=0.0.2,<0.0.3)
|
15
17
|
Requires-Dist: lxml (>=5.3.0,<6.0.0)
|
@@ -21,8 +21,8 @@ liminal/dropdowns/utils.py,sha256=1-H7bTszCUeqeRBpiYXjRjreDzhn1Fd1MFwIsrEI-o4,41
|
|
21
21
|
liminal/entity_schemas/api.py,sha256=Dkd44NGJ4JqRTJLJtPsZ8Qan2owbEYf446A6EuP8iL0,2786
|
22
22
|
liminal/entity_schemas/compare.py,sha256=C5qr9amGCKvkV61pa29obN883vSdFzSoiebD7hKEHY4,14128
|
23
23
|
liminal/entity_schemas/entity_schema_models.py,sha256=SNScXY3SeF0lhdAXwqKXrrgpCphpLg6s5tU9fO3juB4,5239
|
24
|
-
liminal/entity_schemas/generate_files.py,sha256=
|
25
|
-
liminal/entity_schemas/operations.py,sha256=
|
24
|
+
liminal/entity_schemas/generate_files.py,sha256=SW0EccfODptNkZUVwJxa8-8ssd1RWdBqzrCGph4_vSI,8515
|
25
|
+
liminal/entity_schemas/operations.py,sha256=C5Qg7IQVwFqjmk6egIZkV4HaJUmygWRFhLIDqwjOnYQ,23018
|
26
26
|
liminal/entity_schemas/tag_schema_models.py,sha256=rRCAvpjx7iAiIxOh9MRBrpH603zHbFxKOY7sLgOutnE,16260
|
27
27
|
liminal/entity_schemas/utils.py,sha256=X53KNfguWtu7z-tAliBHuCYpSwTqBGgRSGsdR_BU9Vc,4206
|
28
28
|
liminal/enums/__init__.py,sha256=jz_c-B_fifatvrYoESlHZ9ljYdz-3rNl0sBazoESiHI,523
|
@@ -41,21 +41,21 @@ liminal/migrate/revisions_timeline.py,sha256=06qf_7E1Hecucfczpm85rV3ATLDjpCf7y6T
|
|
41
41
|
liminal/migrate/utils.py,sha256=HdSr3N2WN_1S-PLRGVWSMYl-4gIcP-Ph2wPycGi2cGg,3404
|
42
42
|
liminal/orm/base.py,sha256=fFSpiNRYgK5UG7lbXdQGV8KgO8pwjMqt0pycM3rWJ2o,615
|
43
43
|
liminal/orm/base_model.py,sha256=8p-JnqBJYjLe3bJxgjhTteecRsxCeonljrAfxk4reFM,10963
|
44
|
-
liminal/orm/column.py,sha256=
|
44
|
+
liminal/orm/column.py,sha256=e4JWn97s_4EVJ1LOO5l6iucHQUd39Vl0stqMEj0uet8,5114
|
45
45
|
liminal/orm/mixins.py,sha256=yEeUDF1qEBLP523q8bZra4KtNVK0gwZN9mXJSNe3GEE,4802
|
46
46
|
liminal/orm/relationship.py,sha256=Zl4bMHbtDSPx1psGHYnojGGJpA8B8hwcPJdgjB1lmW0,2490
|
47
47
|
liminal/orm/schema_properties.py,sha256=UEIIayhiwHw7YexSGoKU9Z7gj57d7_C1CMUv51-HcGk,2158
|
48
48
|
liminal/orm/user.py,sha256=elRAHj7HgO3iVLK_pNCIwf_9Rl_9k6vkBgaYazoJSQc,818
|
49
49
|
liminal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
50
|
liminal/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
|
-
liminal/tests/conftest.py,sha256=
|
51
|
+
liminal/tests/conftest.py,sha256=1RGiI_h8izLjT9txJ1IkRHYf8yrN_r6yjUn5SI2bxr8,17311
|
52
52
|
liminal/tests/from benchling_sdk.py,sha256=CjRUHFB3iaa4rUPLGOqDiBq5EPKldm-Fd8aQQr92zF4,147
|
53
53
|
liminal/tests/test_dropdown_compare.py,sha256=yHB0ovQlBLRu8-qYkqIPd8VtYEOmOft_93FQM86g_z8,8198
|
54
|
-
liminal/tests/test_entity_schema_compare.py,sha256=
|
54
|
+
liminal/tests/test_entity_schema_compare.py,sha256=p-9inAZM4GOm4e1cadO191LNsnqceUGGyy0YVIXXxVw,16440
|
55
55
|
liminal/utils.py,sha256=vMjSasDnEghwqULDo14joxxJ56G4-9cBsw719nQ8C7g,2798
|
56
56
|
liminal/validation/__init__.py,sha256=SBd48xxBMJrBzI48G2RcK056EMlevt5YjmZMkfCWN1I,6924
|
57
|
-
liminal_orm-1.1.
|
58
|
-
liminal_orm-1.1.
|
59
|
-
liminal_orm-1.1.
|
60
|
-
liminal_orm-1.1.
|
61
|
-
liminal_orm-1.1.
|
57
|
+
liminal_orm-1.1.2.dist-info/LICENSE.md,sha256=oVA877F_D1AV44dpjsv4f-4k690uNGApX1EtzOo3T8U,11353
|
58
|
+
liminal_orm-1.1.2.dist-info/METADATA,sha256=UM5xJJCO9Hy5N8_uxpTqqxgEnxr0bWmKi8LB6R_pLik,11313
|
59
|
+
liminal_orm-1.1.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
60
|
+
liminal_orm-1.1.2.dist-info/entry_points.txt,sha256=atIrU63rrzH81dWC2sjUbFLlc5FWMmYRdMxXEWexIZA,47
|
61
|
+
liminal_orm-1.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|