orchestrator-core 4.0.1__py3-none-any.whl → 4.0.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.
- orchestrator/__init__.py +1 -1
- orchestrator/migrations/helpers.py +14 -6
- {orchestrator_core-4.0.1.dist-info → orchestrator_core-4.0.3.dist-info}/METADATA +1 -1
- {orchestrator_core-4.0.1.dist-info → orchestrator_core-4.0.3.dist-info}/RECORD +6 -6
- {orchestrator_core-4.0.1.dist-info → orchestrator_core-4.0.3.dist-info}/WHEEL +0 -0
- {orchestrator_core-4.0.1.dist-info → orchestrator_core-4.0.3.dist-info}/licenses/LICENSE +0 -0
orchestrator/__init__.py
CHANGED
|
@@ -27,14 +27,22 @@ logger = structlog.get_logger(__name__)
|
|
|
27
27
|
def has_table_column(table_name: str, column_name: str, conn: sa.engine.Connection) -> bool:
|
|
28
28
|
"""Checks if the specified column exists in a given table.
|
|
29
29
|
|
|
30
|
+
inspector.get_columns raises an exception if the table does not exist, so we catch that exception and return False.
|
|
31
|
+
This is useful for migrations where you want to ensure that a column exists before performing operations on it.
|
|
32
|
+
|
|
30
33
|
:param table_name: Name of the database table
|
|
31
34
|
:param column_name: Name of the column to check
|
|
32
35
|
:param conn: SQLAlchemy database Connection
|
|
33
|
-
:return: True if column exists, False otherwise
|
|
36
|
+
:return: True if the column exists, False otherwise
|
|
34
37
|
"""
|
|
35
38
|
inspector = sa.inspect(conn.engine)
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
try:
|
|
40
|
+
columns = inspector.get_columns(table_name)
|
|
41
|
+
return any(col["name"] == column_name for col in columns)
|
|
42
|
+
except sa.exc.NoSuchTableError:
|
|
43
|
+
# On some migrations the table might not exist yet, so we catch the exception
|
|
44
|
+
logger.warning(f"Table {table_name} does not exist.")
|
|
45
|
+
return False
|
|
38
46
|
|
|
39
47
|
|
|
40
48
|
def get_resource_type_id_by_name(conn: sa.engine.Connection, name: str) -> UUID:
|
|
@@ -172,7 +180,7 @@ def create_workflow(conn: sa.engine.Connection, workflow: dict) -> None:
|
|
|
172
180
|
FROM products AS p
|
|
173
181
|
CROSS JOIN new_workflow AS nw
|
|
174
182
|
WHERE p.product_type = :product_type
|
|
175
|
-
ON CONFLICT DO NOTHING
|
|
183
|
+
ON CONFLICT DO NOTHING
|
|
176
184
|
"""
|
|
177
185
|
else:
|
|
178
186
|
# Remove is_task from workflow dict and insert SQL
|
|
@@ -189,7 +197,7 @@ def create_workflow(conn: sa.engine.Connection, workflow: dict) -> None:
|
|
|
189
197
|
FROM products AS p
|
|
190
198
|
CROSS JOIN new_workflow AS nw
|
|
191
199
|
WHERE p.product_type = :product_type
|
|
192
|
-
ON CONFLICT DO NOTHING
|
|
200
|
+
ON CONFLICT DO NOTHING
|
|
193
201
|
"""
|
|
194
202
|
|
|
195
203
|
conn.execute(sa.text(query), workflow)
|
|
@@ -216,7 +224,7 @@ def create_task(conn: sa.engine.Connection, task: dict) -> None:
|
|
|
216
224
|
INSERT INTO workflows(name, target, is_task, description)
|
|
217
225
|
VALUES (:name, 'SYSTEM', TRUE, :description)
|
|
218
226
|
ON CONFLICT DO NOTHING
|
|
219
|
-
RETURNING workflow_id
|
|
227
|
+
RETURNING workflow_id
|
|
220
228
|
"""
|
|
221
229
|
else:
|
|
222
230
|
query = """
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
orchestrator/__init__.py,sha256=
|
|
1
|
+
orchestrator/__init__.py,sha256=0faDTcwh4q9r8oRU7r43vPhElgC7kgHThuTneDaPXzo,1063
|
|
2
2
|
orchestrator/app.py,sha256=7UrXKjBKNSEaSSXAd5ww_RdMFhFqE4yvfj8faS2MzAA,12089
|
|
3
3
|
orchestrator/exception_handlers.py,sha256=UsW3dw8q0QQlNLcV359bIotah8DYjMsj2Ts1LfX4ClY,1268
|
|
4
4
|
orchestrator/log_config.py,sha256=1tPRX5q65e57a6a_zEii_PFK8SzWT0mnA5w2sKg4hh8,1853
|
|
@@ -210,7 +210,7 @@ orchestrator/metrics/subscriptions.py,sha256=vC1O8VmTq5oJxNrn5CU99Rf8cxzdyhc7tXb
|
|
|
210
210
|
orchestrator/migrations/README,sha256=heMzebYwlGhnE8_4CWJ4LS74WoEZjBy-S-mIJRxAEKI,39
|
|
211
211
|
orchestrator/migrations/alembic.ini,sha256=kMoADqhGeubU8xanILNaqm4oixLy9m4ngYtdGpZcc7I,873
|
|
212
212
|
orchestrator/migrations/env.py,sha256=M_cPoAL2axuuup5fvMy8I_WTPHEw0RbPEHkhZ3QEGoE,3740
|
|
213
|
-
orchestrator/migrations/helpers.py,sha256=
|
|
213
|
+
orchestrator/migrations/helpers.py,sha256=fAv_JrFv2RlQtdWYrBhyX2qOwcr8VxmvnRXvf-QA2hg,47972
|
|
214
214
|
orchestrator/migrations/script.py.mako,sha256=607Zrgp-Z-m9WGLt4wewN1QDOmHeifxcePUdADkSZyM,510
|
|
215
215
|
orchestrator/migrations/templates/alembic.ini.j2,sha256=8v7UbKvOiWEbEKQa-Au3uONKUuYx6aflulYanZX6r2I,883
|
|
216
216
|
orchestrator/migrations/templates/env.py.j2,sha256=LIt0ildZTZvNEx3imhy4GNzfFi_rPZg-8H7rGgrBOP8,2717
|
|
@@ -307,7 +307,7 @@ orchestrator/workflows/tasks/resume_workflows.py,sha256=MzJqlSXUvKStkT7NGzxZyRlf
|
|
|
307
307
|
orchestrator/workflows/tasks/validate_product_type.py,sha256=paG-NAY1bdde3Adt8zItkcBKf5Pxw6f5ngGW6an6dYU,3192
|
|
308
308
|
orchestrator/workflows/tasks/validate_products.py,sha256=GZJBoFF-WMphS7ghMs2-gqvV2iL1F0POhk0uSNt93n0,8510
|
|
309
309
|
orchestrator/workflows/translations/en-GB.json,sha256=ST53HxkphFLTMjFHonykDBOZ7-P_KxksktZU3GbxLt0,846
|
|
310
|
-
orchestrator_core-4.0.
|
|
311
|
-
orchestrator_core-4.0.
|
|
312
|
-
orchestrator_core-4.0.
|
|
313
|
-
orchestrator_core-4.0.
|
|
310
|
+
orchestrator_core-4.0.3.dist-info/licenses/LICENSE,sha256=b-aA5OZQuuBATmLKo_mln8CQrDPPhg3ghLzjPjLn4Tg,11409
|
|
311
|
+
orchestrator_core-4.0.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
312
|
+
orchestrator_core-4.0.3.dist-info/METADATA,sha256=fJZSFLupT27n9RMveC25iBnWYIVKXTwZyBP2JOQQeWc,5070
|
|
313
|
+
orchestrator_core-4.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|