File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
[bumpversion]
2
- current_version = 4.0.2
2
+ current_version = 4.0.3
3
3
commit = False
4
4
tag = False
5
5
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(rc(?P<build>\d+))?
Original file line number Diff line number Diff line change 13
13
14
14
"""This is the orchestrator workflow engine."""
15
15
16
- __version__ = "4.0.2 "
16
+ __version__ = "4.0.3 "
17
17
18
18
from orchestrator .app import OrchestratorCore
19
19
from orchestrator .settings import app_settings
Original file line number Diff line number Diff line change 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
- columns = inspector .get_columns (table_name )
37
- return any (col ["name" ] == column_name for col in columns )
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 :
You can’t perform that action at this time.
0 commit comments