liminal-orm 2.0.3a0__tar.gz → 2.0.4__tar.gz

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.
Files changed (156) hide show
  1. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/PKG-INFO +1 -1
  2. liminal_orm-2.0.4/liminal/.DS_Store +0 -0
  3. liminal_orm-2.0.4/liminal/base/__pycache__/__init__.cpython-310.pyc +0 -0
  4. liminal_orm-2.0.4/liminal/base/__pycache__/base.cpython-310.pyc +0 -0
  5. liminal_orm-2.0.4/liminal/base/__pycache__/base_dropdown.cpython-310.pyc +0 -0
  6. liminal_orm-2.0.4/liminal/base/__pycache__/base_operation.cpython-310.pyc +0 -0
  7. liminal_orm-2.0.4/liminal/base/__pycache__/base_validation_filters.cpython-310.pyc +0 -0
  8. liminal_orm-2.0.4/liminal/base/__pycache__/benchling_base_model.cpython-310.pyc +0 -0
  9. liminal_orm-2.0.4/liminal/base/__pycache__/benchling_column.cpython-310.pyc +0 -0
  10. liminal_orm-2.0.4/liminal/base/__pycache__/benchling_dropdown.cpython-310.pyc +0 -0
  11. liminal_orm-2.0.4/liminal/base/__pycache__/benchling_field_properties.cpython-310.pyc +0 -0
  12. liminal_orm-2.0.4/liminal/base/__pycache__/benchling_schema_properties.cpython-310.pyc +0 -0
  13. liminal_orm-2.0.4/liminal/base/__pycache__/callable_operation.cpython-310.pyc +0 -0
  14. liminal_orm-2.0.4/liminal/base/__pycache__/column.cpython-310.pyc +0 -0
  15. liminal_orm-2.0.4/liminal/base/__pycache__/compare_operation.cpython-310.pyc +0 -0
  16. liminal_orm-2.0.4/liminal/base/__pycache__/field_properties.cpython-310.pyc +0 -0
  17. liminal_orm-2.0.4/liminal/base/__pycache__/name_template_components.cpython-310.pyc +0 -0
  18. liminal_orm-2.0.4/liminal/base/__pycache__/name_template_parts.cpython-310.pyc +0 -0
  19. liminal_orm-2.0.4/liminal/base/__pycache__/schema_properties.cpython-310.pyc +0 -0
  20. liminal_orm-2.0.4/liminal/base/__pycache__/str_enum.cpython-310.pyc +0 -0
  21. liminal_orm-2.0.4/liminal/base/__pycache__/unset.cpython-310.pyc +0 -0
  22. liminal_orm-2.0.4/liminal/base/__pycache__/user.cpython-310.pyc +0 -0
  23. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/base_operation.py +7 -7
  24. liminal_orm-2.0.4/liminal/base/properties/__pycache__/NoDropdown.cpython-310.pyc +0 -0
  25. liminal_orm-2.0.4/liminal/base/properties/__pycache__/__init__.cpython-310.pyc +0 -0
  26. liminal_orm-2.0.4/liminal/base/properties/__pycache__/base_field_properties.cpython-310.pyc +0 -0
  27. liminal_orm-2.0.4/liminal/base/properties/__pycache__/base_name_template.cpython-310.pyc +0 -0
  28. liminal_orm-2.0.4/liminal/base/properties/__pycache__/base_schema_properties.cpython-310.pyc +0 -0
  29. liminal_orm-2.0.4/liminal/base/properties/__pycache__/field_properties.cpython-310.pyc +0 -0
  30. liminal_orm-2.0.4/liminal/base/properties/__pycache__/schema_properties.cpython-310.pyc +0 -0
  31. liminal_orm-2.0.4/liminal/cli/__pycache__/cli.cpython-310.pyc +0 -0
  32. liminal_orm-2.0.4/liminal/cli/__pycache__/controller.cpython-310.pyc +0 -0
  33. liminal_orm-2.0.4/liminal/cli/__pycache__/live_test_dropdown_migration.cpython-310.pyc +0 -0
  34. liminal_orm-2.0.4/liminal/cli/__pycache__/live_test_entity_schema_migration.cpython-310.pyc +0 -0
  35. liminal_orm-2.0.4/liminal/connection/__pycache__/__init__.cpython-310.pyc +0 -0
  36. liminal_orm-2.0.4/liminal/connection/__pycache__/benchling_connection.cpython-310.pyc +0 -0
  37. liminal_orm-2.0.4/liminal/connection/__pycache__/benchling_service.cpython-310.pyc +0 -0
  38. liminal_orm-2.0.4/liminal/dropdowns/__pycache__/api.cpython-310.pyc +0 -0
  39. liminal_orm-2.0.4/liminal/dropdowns/__pycache__/compare.cpython-310.pyc +0 -0
  40. liminal_orm-2.0.4/liminal/dropdowns/__pycache__/generate_files.cpython-310.pyc +0 -0
  41. liminal_orm-2.0.4/liminal/dropdowns/__pycache__/operations.cpython-310.pyc +0 -0
  42. liminal_orm-2.0.4/liminal/dropdowns/__pycache__/utils.cpython-310.pyc +0 -0
  43. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/api.cpython-310.pyc +0 -0
  44. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/compare.cpython-310.pyc +0 -0
  45. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/entity_schema_models.cpython-310.pyc +0 -0
  46. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/generate_files.cpython-310.pyc +0 -0
  47. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/operations.cpython-310.pyc +0 -0
  48. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/schemas.cpython-310.pyc +0 -0
  49. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/tag_schema_models.cpython-310.pyc +0 -0
  50. liminal_orm-2.0.4/liminal/entity_schemas/__pycache__/utils.cpython-310.pyc +0 -0
  51. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/compare.py +40 -21
  52. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/generate_files.py +1 -1
  53. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/tag_schema_models.py +1 -1
  54. liminal_orm-2.0.4/liminal/enums/__pycache__/__init__.cpython-310.pyc +0 -0
  55. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_api_field_type.cpython-310.pyc +0 -0
  56. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_dropdown.cpython-310.pyc +0 -0
  57. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_entity_type.cpython-310.pyc +0 -0
  58. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_enum.cpython-310.pyc +0 -0
  59. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_field_api_type.cpython-310.pyc +0 -0
  60. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_field_type.cpython-310.pyc +0 -0
  61. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_folder_item_type.cpython-310.pyc +0 -0
  62. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_naming_strategy.cpython-310.pyc +0 -0
  63. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_report_level.cpython-310.pyc +0 -0
  64. liminal_orm-2.0.4/liminal/enums/__pycache__/benchling_sequence_type.cpython-310.pyc +0 -0
  65. liminal_orm-2.0.4/liminal/enums/__pycache__/name_template_part_type.cpython-310.pyc +0 -0
  66. liminal_orm-2.0.4/liminal/enums/__pycache__/str_enum.cpython-310.pyc +0 -0
  67. liminal_orm-2.0.4/liminal/enums/__pycache__/undefined.cpython-310.pyc +0 -0
  68. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/benchling_field_type.py +4 -0
  69. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/benchling_naming_strategy.py +1 -0
  70. liminal_orm-2.0.4/liminal/external/__pycache__/__init__.cpython-310.pyc +0 -0
  71. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/mappers.py +5 -2
  72. liminal_orm-2.0.4/liminal/migrate/__pycache__/components.cpython-310.pyc +0 -0
  73. liminal_orm-2.0.4/liminal/migrate/__pycache__/revision.cpython-310.pyc +0 -0
  74. liminal_orm-2.0.4/liminal/migrate/__pycache__/revisions_timeline.cpython-310.pyc +0 -0
  75. liminal_orm-2.0.4/liminal/migrate/__pycache__/utils.cpython-310.pyc +0 -0
  76. liminal_orm-2.0.4/liminal/orm/__pycache__/__init__.cpython-310.pyc +0 -0
  77. liminal_orm-2.0.4/liminal/orm/__pycache__/base.cpython-310.pyc +0 -0
  78. liminal_orm-2.0.4/liminal/orm/__pycache__/base_model.cpython-310.pyc +0 -0
  79. liminal_orm-2.0.4/liminal/orm/__pycache__/column.cpython-310.pyc +0 -0
  80. liminal_orm-2.0.4/liminal/orm/__pycache__/mixins.cpython-310.pyc +0 -0
  81. liminal_orm-2.0.4/liminal/orm/__pycache__/name_template.cpython-310.pyc +0 -0
  82. liminal_orm-2.0.4/liminal/orm/__pycache__/name_template_parts.cpython-310.pyc +0 -0
  83. liminal_orm-2.0.4/liminal/orm/__pycache__/relationship.cpython-310.pyc +0 -0
  84. liminal_orm-2.0.4/liminal/orm/__pycache__/schema_properties.cpython-310.pyc +0 -0
  85. liminal_orm-2.0.4/liminal/orm/__pycache__/user.cpython-310.pyc +0 -0
  86. liminal_orm-2.0.4/liminal/orm/base_tables/__pycache__/__init__.cpython-310.pyc +0 -0
  87. liminal_orm-2.0.4/liminal/orm/base_tables/__pycache__/registry_entity.cpython-310.pyc +0 -0
  88. liminal_orm-2.0.4/liminal/orm/base_tables/__pycache__/schema.cpython-310.pyc +0 -0
  89. liminal_orm-2.0.4/liminal/orm/base_tables/__pycache__/user.cpython-310.pyc +0 -0
  90. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/column.py +5 -5
  91. liminal_orm-2.0.4/liminal/tests/.DS_Store +0 -0
  92. liminal_orm-2.0.4/liminal/tests/__pycache__/__init__.cpython-310.pyc +0 -0
  93. liminal_orm-2.0.4/liminal/tests/__pycache__/conftest.cpython-310-pytest-8.3.3.pyc +0 -0
  94. liminal_orm-2.0.4/liminal/tests/__pycache__/test_dropdown_compare.cpython-310-pytest-8.3.3.pyc +0 -0
  95. liminal_orm-2.0.4/liminal/tests/__pycache__/test_entity_schema_compare.cpython-310-pytest-8.3.3.pyc +0 -0
  96. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/validation/__init__.py +2 -9
  97. liminal_orm-2.0.4/liminal/validation/__pycache__/__init__.cpython-310.pyc +0 -0
  98. liminal_orm-2.0.4/liminal/validation/__pycache__/validation_report_level.cpython-310.pyc +0 -0
  99. liminal_orm-2.0.4/liminal/validation/__pycache__/validation_severity.cpython-310.pyc +0 -0
  100. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/pyproject.toml +1 -1
  101. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/LICENSE.md +0 -0
  102. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/README.md +0 -0
  103. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/__init__.py +0 -0
  104. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/base_dropdown.py +0 -0
  105. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/base_validation_filters.py +0 -0
  106. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/compare_operation.py +0 -0
  107. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/name_template_parts.py +0 -0
  108. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/properties/base_field_properties.py +0 -0
  109. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/properties/base_name_template.py +0 -0
  110. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/properties/base_schema_properties.py +0 -0
  111. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/base/str_enum.py +0 -0
  112. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/cli/cli.py +0 -0
  113. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/cli/controller.py +0 -0
  114. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/cli/live_test_dropdown_migration.py +0 -0
  115. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/cli/live_test_entity_schema_migration.py +0 -0
  116. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/connection/__init__.py +0 -0
  117. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/connection/benchling_connection.py +0 -0
  118. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/connection/benchling_service.py +0 -0
  119. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/dropdowns/api.py +0 -0
  120. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/dropdowns/compare.py +0 -0
  121. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/dropdowns/generate_files.py +0 -0
  122. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/dropdowns/operations.py +0 -0
  123. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/dropdowns/utils.py +0 -0
  124. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/api.py +0 -0
  125. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/entity_schema_models.py +0 -0
  126. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/operations.py +7 -7
  127. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/entity_schemas/utils.py +0 -0
  128. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/__init__.py +0 -0
  129. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/benchling_api_field_type.py +0 -0
  130. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/benchling_entity_type.py +0 -0
  131. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/benchling_folder_item_type.py +0 -0
  132. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/benchling_sequence_type.py +0 -0
  133. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/enums/name_template_part_type.py +0 -0
  134. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/external/__init__.py +0 -0
  135. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/migrate/components.py +0 -0
  136. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/migrate/revision.py +0 -0
  137. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/migrate/revisions_timeline.py +0 -0
  138. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/migrate/utils.py +0 -0
  139. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/base.py +0 -0
  140. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/base_model.py +0 -0
  141. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/base_tables/registry_entity.py +0 -0
  142. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/base_tables/schema.py +0 -0
  143. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/base_tables/user.py +0 -0
  144. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/mixins.py +0 -0
  145. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/name_template.py +0 -0
  146. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/name_template_parts.py +0 -0
  147. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/relationship.py +0 -0
  148. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/orm/schema_properties.py +0 -0
  149. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/py.typed +0 -0
  150. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/tests/__init__.py +0 -0
  151. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/tests/conftest.py +0 -0
  152. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/tests/from benchling_sdk.py +0 -0
  153. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/tests/test_dropdown_compare.py +0 -0
  154. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/tests/test_entity_schema_compare.py +0 -0
  155. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/utils.py +0 -0
  156. {liminal_orm-2.0.3a0 → liminal_orm-2.0.4}/liminal/validation/validation_severity.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: liminal-orm
3
- Version: 2.0.3a0
3
+ Version: 2.0.4
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
Binary file
@@ -13,13 +13,13 @@ Order of operations based on order class var:
13
13
  6. ArchiveDropdownOption
14
14
  7. ReorderDropdownOptions
15
15
  8. CreateSchema
16
- 9. UpdateSchema
17
- 10. UnarchiveSchema
18
- 11. CreateField
19
- 12. UnarchiveField
20
- 13. UpdateField
21
- 14. ArchiveField
22
- 15. UpdateEntitySchemaNameTemplate
16
+ 9. UpdateEntitySchemaNameTemplate
17
+ 10. UpdateSchema
18
+ 11. UnarchiveSchema
19
+ 12. CreateField
20
+ 13. UnarchiveField
21
+ 14. UpdateField
22
+ 15. ArchiveField
23
23
  16. ReorderFields
24
24
  17. ArchiveSchema
25
25
  18. ArchiveDropdown
@@ -18,6 +18,7 @@ from liminal.entity_schemas.operations import (
18
18
  UpdateEntitySchemaNameTemplate,
19
19
  )
20
20
  from liminal.entity_schemas.utils import get_converted_tag_schemas
21
+ from liminal.enums.benchling_naming_strategy import BenchlingNamingStrategy
21
22
  from liminal.orm.base_model import BaseModel
22
23
  from liminal.orm.column import Column
23
24
  from liminal.utils import to_snake_case
@@ -275,6 +276,16 @@ def compare_entity_schemas(
275
276
  col.properties.set_warehouse_name(wh_name)
276
277
  for wh_name, col in model_columns.items()
277
278
  ]
279
+ template_based_naming_strategies = {
280
+ s
281
+ for s in model.__schema_properties__.naming_strategies
282
+ if BenchlingNamingStrategy.is_template_based(s)
283
+ }
284
+ model.__schema_properties__.naming_strategies = {
285
+ s
286
+ for s in model.__schema_properties__.naming_strategies
287
+ if not BenchlingNamingStrategy.is_template_based(s)
288
+ }
278
289
  ops.append(
279
290
  CompareOperation(
280
291
  op=CreateEntitySchema(
@@ -288,28 +299,10 @@ def compare_entity_schemas(
288
299
  ),
289
300
  )
290
301
  )
291
- benchling_given_wh_name = to_snake_case(model.__schema_properties__.name)
292
- if model.__schema_properties__.warehouse_name != benchling_given_wh_name:
293
- ops.append(
294
- CompareOperation(
295
- op=UpdateEntitySchema(
296
- benchling_given_wh_name,
297
- BaseSchemaProperties(
298
- warehouse_name=model.__schema_properties__.warehouse_name
299
- ),
300
- ),
301
- reverse_op=UpdateEntitySchema(
302
- model.__schema_properties__.warehouse_name,
303
- BaseSchemaProperties(
304
- warehouse_name=benchling_given_wh_name
305
- ),
306
- ),
307
- )
308
- )
309
302
  benchling_given_name_template = BaseNameTemplate(
310
303
  parts=[], order_name_parts_by_sequence=False
311
304
  )
312
- if benchling_name_template != model.__name_template__:
305
+ if benchling_given_name_template != model.__name_template__:
313
306
  ops.append(
314
307
  CompareOperation(
315
308
  op=UpdateEntitySchemaNameTemplate(
@@ -323,13 +316,39 @@ def compare_entity_schemas(
323
316
  reverse_op=UpdateEntitySchemaNameTemplate(
324
317
  model.__schema_properties__.warehouse_name,
325
318
  BaseNameTemplate(
326
- **benchling_given_name_template.merge(
327
- model.__name_template__
319
+ **model.__name_template__.merge(
320
+ benchling_given_name_template
328
321
  )
329
322
  ),
330
323
  ),
331
324
  )
332
325
  )
326
+ benchling_given_wh_name = to_snake_case(model.__schema_properties__.name)
327
+ new_schema_props = BaseSchemaProperties()
328
+ rollback_schema_props = BaseSchemaProperties()
329
+ if model.__schema_properties__.warehouse_name != benchling_given_wh_name:
330
+ new_schema_props.warehouse_name = (
331
+ model.__schema_properties__.warehouse_name
332
+ )
333
+ rollback_schema_props.warehouse_name = benchling_given_wh_name
334
+ if template_based_naming_strategies:
335
+ new_schema_props.naming_strategies = template_based_naming_strategies
336
+ rollback_schema_props.naming_strategies = (
337
+ model.__schema_properties__.naming_strategies
338
+ )
339
+ if new_schema_props.model_dump(exclude_unset=True) != {}:
340
+ ops.append(
341
+ CompareOperation(
342
+ op=UpdateEntitySchema(
343
+ benchling_given_wh_name,
344
+ new_schema_props,
345
+ ),
346
+ reverse_op=UpdateEntitySchema(
347
+ model.__schema_properties__.warehouse_name,
348
+ rollback_schema_props,
349
+ ),
350
+ )
351
+ )
333
352
 
334
353
  model_operations[model.__schema_properties__.warehouse_name] = ops
335
354
  running_benchling_schema_names = [
@@ -105,7 +105,7 @@ def generate_all_entity_schema_files(
105
105
  if not has_date:
106
106
  import_strings.append("from datetime import datetime")
107
107
  if (
108
- col.type == BenchlingFieldType.ENTITY_LINK
108
+ col.type in BenchlingFieldType.get_entity_link_types()
109
109
  and col.entity_link is not None
110
110
  ):
111
111
  if not col.is_multi:
@@ -164,7 +164,7 @@ class CreateTagSchemaFieldModel(BaseModel):
164
164
  )
165
165
 
166
166
  tagSchema = None
167
- if new_props.type == BenchlingFieldType.ENTITY_LINK:
167
+ if new_props.type in BenchlingFieldType.get_entity_link_types():
168
168
  if new_props.entity_link is not None:
169
169
  if benchling_service is None:
170
170
  raise ValueError(
@@ -32,3 +32,7 @@ class BenchlingFieldType(StrEnum):
32
32
  cls.DATE,
33
33
  cls.DATETIME,
34
34
  ]
35
+
36
+ @classmethod
37
+ def get_entity_link_types(cls) -> list[str]:
38
+ return [cls.ENTITY_LINK, cls.TRANSLATION_LINK]
@@ -11,6 +11,7 @@ class BenchlingNamingStrategy(StrEnum):
11
11
  )
12
12
  RENAME_WITH_TEMPLATE_WITH_ALIAS = "SET_FROM_NAME_PARTS" # Generate new registry IDs, rename according to name template, and keep old name as alias
13
13
  REPLACE_NAMES_WITH_TEMPLATE = "REPLACE_NAMES_FROM_PARTS" # Generate new registry IDs, and replace name according to name template
14
+ KEEP_NAMES = "KEEP_NAMES" # Keeps the original name
14
15
 
15
16
  @classmethod
16
17
  def is_template_based(cls, strategy: BenchlingNamingStrategy) -> bool:
@@ -22,6 +22,8 @@ def convert_benchling_type_to_python_type(benchling_type: BenchlingFieldType) ->
22
22
  BenchlingFieldType.BLOB_LINK: dict[str, Any],
23
23
  BenchlingFieldType.CUSTOM_ENTITY_LINK: str,
24
24
  BenchlingFieldType.DNA_SEQUENCE_LINK: str,
25
+ BenchlingFieldType.AA_SEQUENCE_LINK: str,
26
+ BenchlingFieldType.TRANSLATION_LINK: str,
25
27
  BenchlingFieldType.DROPDOWN: str,
26
28
  BenchlingFieldType.ENTITY_LINK: str,
27
29
  BenchlingFieldType.ENTRY_LINK: str,
@@ -48,6 +50,8 @@ def convert_benchling_type_to_sql_alchemy_type(
48
50
  BenchlingFieldType.BLOB_LINK: JSON,
49
51
  BenchlingFieldType.CUSTOM_ENTITY_LINK: String,
50
52
  BenchlingFieldType.DNA_SEQUENCE_LINK: String,
53
+ BenchlingFieldType.AA_SEQUENCE_LINK: String,
54
+ BenchlingFieldType.TRANSLATION_LINK: String,
51
55
  BenchlingFieldType.DROPDOWN: String,
52
56
  BenchlingFieldType.ENTITY_LINK: String,
53
57
  BenchlingFieldType.ENTRY_LINK: String,
@@ -55,7 +59,6 @@ def convert_benchling_type_to_sql_alchemy_type(
55
59
  BenchlingFieldType.STORAGE_LINK: String,
56
60
  BenchlingFieldType.PART_LINK: String,
57
61
  BenchlingFieldType.MIXTURE_LINK: String,
58
- BenchlingFieldType.AA_SEQUENCE_LINK: String,
59
62
  BenchlingFieldType.TEXT: String,
60
63
  }
61
64
  if benchling_type in benchling_to_sql_alchemy_type_map:
@@ -141,7 +144,7 @@ def convert_api_field_type_to_field_type(
141
144
  ): BenchlingFieldType.PART_LINK,
142
145
  (
143
146
  BenchlingAPIFieldType.TRANSLATION_LINK,
144
- BenchlingFolderItemType.SEQUENCE,
147
+ None,
145
148
  ): BenchlingFieldType.TRANSLATION_LINK,
146
149
  (BenchlingAPIFieldType.FILE_LINK, None): BenchlingFieldType.ENTITY_LINK,
147
150
  (BenchlingAPIFieldType.FLOAT, None): BenchlingFieldType.DECIMAL,
@@ -73,19 +73,19 @@ class Column(SqlColumn):
73
73
  raise ValueError("Dropdown can only be set if the field type is DROPDOWN.")
74
74
  if dropdown is None and type == BenchlingFieldType.DROPDOWN:
75
75
  raise ValueError("Dropdown must be set if the field type is DROPDOWN.")
76
- if entity_link and type != BenchlingFieldType.ENTITY_LINK:
76
+ if entity_link and type not in BenchlingFieldType.get_entity_link_types():
77
77
  raise ValueError(
78
- "Entity link can only be set if the field type is ENTITY_LINK."
78
+ "Entity link can only be set if the field type is ENTITY_LINK or TRANSLATION_LINK."
79
79
  )
80
- if parent_link and type != BenchlingFieldType.ENTITY_LINK:
80
+ if parent_link and type not in BenchlingFieldType.get_entity_link_types():
81
81
  raise ValueError(
82
- "Parent link can only be set if the field type is ENTITY_LINK."
82
+ "Parent link can only be set if the field type is ENTITY_LINK or TRANSLATION_LINK."
83
83
  )
84
84
  if type in BenchlingFieldType.get_non_multi_select_types() and is_multi is True:
85
85
  raise ValueError(f"Field type {type} cannot have multi-value set as True.")
86
86
  self.sqlalchemy_type = sqlalchemy_type
87
87
  foreign_key = None
88
- if type == BenchlingFieldType.ENTITY_LINK and entity_link:
88
+ if type in BenchlingFieldType.get_entity_link_types() and entity_link:
89
89
  foreign_key = ForeignKey(f"{entity_link}$raw.id")
90
90
  if _warehouse_name:
91
91
  kwargs["name"] = _warehouse_name
@@ -1,4 +1,3 @@
1
- import inspect
2
1
  from datetime import datetime
3
2
  from functools import partial, wraps
4
3
  from typing import TYPE_CHECKING, Any, Callable
@@ -102,7 +101,7 @@ class BenchlingValidatorReport(BaseModel):
102
101
 
103
102
 
104
103
  def liminal_validator(
105
- func: Callable[[type["BenchlingBaseModel"]], BenchlingValidatorReport | None]
104
+ func: Callable[["BenchlingBaseModel"], BenchlingValidatorReport | None]
106
105
  | None = None,
107
106
  *,
108
107
  validator_level: ValidationSeverity = ValidationSeverity.LOW,
@@ -125,15 +124,9 @@ def liminal_validator(
125
124
  validator_level=validator_level,
126
125
  validator_name=validator_name,
127
126
  )
128
- elif not isinstance(
129
- func, Callable[[type["BenchlingBaseModel"]], BenchlingValidatorReport | None]
130
- ):
131
- raise ValueError(
132
- "Parameters passed to liminal_validator must be keyword arguments, not positional arguments."
133
- )
134
127
 
135
128
  @wraps(func)
136
- def wrapper(self: type["BenchlingBaseModel"]) -> BenchlingValidatorReport:
129
+ def wrapper(self: "BenchlingBaseModel") -> BenchlingValidatorReport:
137
130
  """Wrapper that runs the validator function and returns a BenchlingValidatorReport."""
138
131
  try:
139
132
  ret_val = func(self)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "liminal-orm"
3
- version = "2.0.3a0"
3
+ version = "2.0.4"
4
4
  description = "An ORM and toolkit that builds on top of Benchling's platform to keep your schemas and downstream code dependencies in sync."
5
5
  authors = ["DynoTx Open Source <opensource@dynotx.com>"]
6
6
  readme = "README.md"
File without changes
File without changes
@@ -162,7 +162,7 @@ class ArchiveEntitySchema(BaseOperation):
162
162
 
163
163
 
164
164
  class UnarchiveEntitySchema(BaseOperation):
165
- order: ClassVar[int] = 100
165
+ order: ClassVar[int] = 110
166
166
 
167
167
  def __init__(self, wh_schema_name: str) -> None:
168
168
  self.wh_schema_name = wh_schema_name
@@ -187,7 +187,7 @@ class UnarchiveEntitySchema(BaseOperation):
187
187
 
188
188
 
189
189
  class UpdateEntitySchema(BaseOperation):
190
- order: ClassVar[int] = 90
190
+ order: ClassVar[int] = 100
191
191
 
192
192
  def __init__(
193
193
  self,
@@ -251,7 +251,7 @@ class UpdateEntitySchema(BaseOperation):
251
251
 
252
252
 
253
253
  class UpdateEntitySchemaNameTemplate(BaseOperation):
254
- order: ClassVar[int] = 150
254
+ order: ClassVar[int] = 90
255
255
 
256
256
  def __init__(
257
257
  self,
@@ -283,7 +283,7 @@ class UpdateEntitySchemaNameTemplate(BaseOperation):
283
283
 
284
284
 
285
285
  class CreateEntitySchemaField(BaseOperation):
286
- order: ClassVar[int] = 110
286
+ order: ClassVar[int] = 120
287
287
 
288
288
  def __init__(
289
289
  self,
@@ -370,7 +370,7 @@ class CreateEntitySchemaField(BaseOperation):
370
370
 
371
371
 
372
372
  class ArchiveEntitySchemaField(BaseOperation):
373
- order: ClassVar[int] = 140
373
+ order: ClassVar[int] = 150
374
374
 
375
375
  def __init__(
376
376
  self, wh_schema_name: str, wh_field_name: str, index: int | None = None
@@ -421,7 +421,7 @@ class ArchiveEntitySchemaField(BaseOperation):
421
421
 
422
422
 
423
423
  class UnarchiveEntitySchemaField(BaseOperation):
424
- order: ClassVar[int] = 120
424
+ order: ClassVar[int] = 130
425
425
 
426
426
  def __init__(
427
427
  self, wh_schema_name: str, wh_field_name: str, index: int | None = None
@@ -468,7 +468,7 @@ class UnarchiveEntitySchemaField(BaseOperation):
468
468
 
469
469
 
470
470
  class UpdateEntitySchemaField(BaseOperation):
471
- order: ClassVar[int] = 130
471
+ order: ClassVar[int] = 140
472
472
 
473
473
  def __init__(
474
474
  self,