dataflow-core 2.1.12__py3-none-any.whl → 2.1.14__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.
Potentially problematic release.
This version of dataflow-core might be problematic. Click here for more details.
- dataflow/dataflow.py +34 -7
- dataflow/models/variables.py +9 -2
- dataflow/schemas/connection.py +4 -4
- dataflow/schemas/secret.py +4 -4
- {dataflow_core-2.1.12.dist-info → dataflow_core-2.1.14.dist-info}/METADATA +1 -1
- {dataflow_core-2.1.12.dist-info → dataflow_core-2.1.14.dist-info}/RECORD +9 -9
- {dataflow_core-2.1.12.dist-info → dataflow_core-2.1.14.dist-info}/WHEEL +0 -0
- {dataflow_core-2.1.12.dist-info → dataflow_core-2.1.14.dist-info}/entry_points.txt +0 -0
- {dataflow_core-2.1.12.dist-info → dataflow_core-2.1.14.dist-info}/top_level.txt +0 -0
dataflow/dataflow.py
CHANGED
|
@@ -8,6 +8,34 @@ class Dataflow:
|
|
|
8
8
|
"""
|
|
9
9
|
Dataflow class to interact with Dataflow services.
|
|
10
10
|
"""
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def _json_parse(value):
|
|
14
|
+
try:
|
|
15
|
+
result = json.loads(value)
|
|
16
|
+
if isinstance(result, str):
|
|
17
|
+
try:
|
|
18
|
+
return json.loads(result)
|
|
19
|
+
except json.JSONDecodeError:
|
|
20
|
+
return result
|
|
21
|
+
return result
|
|
22
|
+
except (json.JSONDecodeError, TypeError):
|
|
23
|
+
return value
|
|
24
|
+
|
|
25
|
+
def _parse_response_data(self, response):
|
|
26
|
+
"""Parse response data based on datatype field or fallback to JSON parsing."""
|
|
27
|
+
data = response.json()
|
|
28
|
+
value = data.get('value', '')
|
|
29
|
+
if isinstance(data, dict) and 'datatype' in data:
|
|
30
|
+
value = data.get('value', '')
|
|
31
|
+
datatype = data.get('datatype')
|
|
32
|
+
if datatype == 'json':
|
|
33
|
+
return self._json_parse(value)
|
|
34
|
+
else:
|
|
35
|
+
return value
|
|
36
|
+
else:
|
|
37
|
+
return self._json_parse(value)
|
|
38
|
+
|
|
11
39
|
def auth(self, session_id: str):
|
|
12
40
|
"""
|
|
13
41
|
Retrieve and return user information using their session ID.
|
|
@@ -41,7 +69,7 @@ class Dataflow:
|
|
|
41
69
|
|
|
42
70
|
except Exception as e:
|
|
43
71
|
return e
|
|
44
|
-
|
|
72
|
+
|
|
45
73
|
def variable(self, variable_name: str):
|
|
46
74
|
"""
|
|
47
75
|
Retrieve a Dataflow variable.
|
|
@@ -106,9 +134,9 @@ class Dataflow:
|
|
|
106
134
|
elif response.status_code != 200:
|
|
107
135
|
print(f"[Dataflow.variable] Unexpected status {response.status_code} for variable '{variable_name}'")
|
|
108
136
|
return None
|
|
137
|
+
|
|
138
|
+
return self._parse_response_data(response)
|
|
109
139
|
|
|
110
|
-
return response.text.strip().strip('"')
|
|
111
|
-
|
|
112
140
|
except requests.exceptions.RequestException as e:
|
|
113
141
|
raise RuntimeError(f"[Dataflow.variable] Failed to fetch variable '{variable_name}'") from e
|
|
114
142
|
|
|
@@ -163,8 +191,8 @@ class Dataflow:
|
|
|
163
191
|
print(f"[Dataflow.secret] Unexpected status {response.status_code} for secret '{secret_name}'")
|
|
164
192
|
return None
|
|
165
193
|
|
|
166
|
-
return
|
|
167
|
-
|
|
194
|
+
return self._parse_response_data(response)
|
|
195
|
+
|
|
168
196
|
except requests.exceptions.RequestException as e:
|
|
169
197
|
raise RuntimeError(f"[Dataflow.secret] Failed to fetch secret '{secret_name}'") from e
|
|
170
198
|
except Exception as e:
|
|
@@ -313,8 +341,7 @@ class Dataflow:
|
|
|
313
341
|
print(f"[Dataflow.variable_or_secret] Unexpected status {response.status_code} for key '{key}'")
|
|
314
342
|
return None
|
|
315
343
|
|
|
316
|
-
|
|
317
|
-
return response_text
|
|
344
|
+
return self._parse_response_data(response)
|
|
318
345
|
|
|
319
346
|
except requests.exceptions.RequestException as e:
|
|
320
347
|
raise RuntimeError(f"[Dataflow.variable_or_secret] Failed to fetch '{key}'") from e
|
dataflow/models/variables.py
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
from sqlalchemy import Column, Integer, String, ForeignKey, Text, DateTime, func, UniqueConstraint, CheckConstraint, Boolean
|
|
1
|
+
from sqlalchemy import Column, Integer, String, ForeignKey, Text, DateTime, func, UniqueConstraint, CheckConstraint, Boolean, Enum
|
|
2
2
|
from dataflow.db import Base
|
|
3
|
+
import enum
|
|
3
4
|
|
|
5
|
+
class DataType(str, enum.Enum):
|
|
6
|
+
raw = "raw"
|
|
7
|
+
json = "json"
|
|
8
|
+
file = "file"
|
|
4
9
|
class Variable(Base):
|
|
5
10
|
"""
|
|
6
11
|
Unified VARIABLE table to support both Studio and Runtime environments.
|
|
@@ -13,13 +18,15 @@ class Variable(Base):
|
|
|
13
18
|
value = Column(Text, nullable=False)
|
|
14
19
|
type = Column(String, nullable=False)
|
|
15
20
|
description = Column(Text, nullable=True)
|
|
21
|
+
filename = Column(String, nullable=True)
|
|
16
22
|
runtime = Column(String, nullable=True)
|
|
17
23
|
slug = Column(String, nullable=True)
|
|
18
24
|
created_at = Column(DateTime, server_default=func.now())
|
|
19
25
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
|
20
26
|
created_by = Column(String, ForeignKey('USER.user_name'), nullable=True)
|
|
21
27
|
is_active = Column(Boolean, default=True, nullable=False)
|
|
22
|
-
|
|
28
|
+
datatype = Column(Enum(DataType, name="data_type"), nullable=False)
|
|
29
|
+
set_as_env = Column(Boolean, default=False, nullable=False)
|
|
23
30
|
|
|
24
31
|
__table_args__ = (
|
|
25
32
|
CheckConstraint(type.in_(['variable', 'secret']), name='check_variable_type'),
|
dataflow/schemas/connection.py
CHANGED
|
@@ -29,11 +29,11 @@ class ConnectionBase(BaseModel):
|
|
|
29
29
|
import re
|
|
30
30
|
if not isinstance(v, str):
|
|
31
31
|
raise ValueError("Connection ID must be a string.")
|
|
32
|
-
if len(v) >
|
|
33
|
-
raise ValueError("Connection ID must be at most
|
|
34
|
-
if not re.fullmatch(r"[A-Za-z0-
|
|
32
|
+
if len(v) > 30:
|
|
33
|
+
raise ValueError("Connection ID must be at most 30 characters long.")
|
|
34
|
+
if not re.fullmatch(r"[A-Za-z0-9_-]+", v):
|
|
35
35
|
raise ValueError(
|
|
36
|
-
"Connection ID can only contain letters, numbers, and hyphens (-)!"
|
|
36
|
+
"Connection ID can only contain letters, numbers, underscores (_), and hyphens (-)!"
|
|
37
37
|
)
|
|
38
38
|
return v
|
|
39
39
|
|
dataflow/schemas/secret.py
CHANGED
|
@@ -16,11 +16,11 @@ class SecretBase(BaseModel):
|
|
|
16
16
|
import re
|
|
17
17
|
if not isinstance(v, str):
|
|
18
18
|
raise ValueError("Secret key must be a string.")
|
|
19
|
-
if len(v) >
|
|
20
|
-
raise ValueError("Secret key must be at most
|
|
21
|
-
if not re.fullmatch(r"[A-Za-z0-
|
|
19
|
+
if len(v) > 30:
|
|
20
|
+
raise ValueError("Secret key must be at most 30 characters long.")
|
|
21
|
+
if not re.fullmatch(r"[A-Za-z0-9_-]+", v):
|
|
22
22
|
raise ValueError(
|
|
23
|
-
"Secret key can only contain letters, numbers, and hyphens (-)!"
|
|
23
|
+
"Secret key can only contain letters, numbers, underscores (_), and hyphens (-)!"
|
|
24
24
|
)
|
|
25
25
|
return v
|
|
26
26
|
|
|
@@ -5,7 +5,7 @@ authenticator/dataflowsupersetauthenticator.py,sha256=NkAmDaIc-ui-qEolu4xz_UY7P_
|
|
|
5
5
|
dataflow/__init__.py,sha256=WTRg8HMpMWSgxYJ9ZGVldx4k07fAbta3mBmZ1hG9mWE,30
|
|
6
6
|
dataflow/configuration.py,sha256=7To6XwH1eESiYp39eqPcswXWwrdBUdPF6xN6WnazOF0,663
|
|
7
7
|
dataflow/database_manager.py,sha256=tJHMuOZ9Muskrh9t4uLRlTuFU0VkHAzoHlGP5DORIC4,899
|
|
8
|
-
dataflow/dataflow.py,sha256=
|
|
8
|
+
dataflow/dataflow.py,sha256=0kPDIpFgrEcK81QYeLQGb-rQTrAH-83gLpn566yvBGA,14004
|
|
9
9
|
dataflow/db.py,sha256=73ojGqpCTRVTlPszD73Ozhjih_BI2KTHmazqxxL6iWk,3780
|
|
10
10
|
dataflow/environment.py,sha256=qiyuRRPpVLVWiYccRHXnGyWMr_ZBPWzixAyDtAzxQYE,28277
|
|
11
11
|
dataflow/models/__init__.py,sha256=5Ai-sUHtT1dtc0l4nL1fuwVbx0GcwaGQg_LXqOzWb4c,981
|
|
@@ -31,11 +31,11 @@ dataflow/models/team.py,sha256=fjkqF0N4PSwSYTgHjEQl9wuC7yumd0iOb5nNFePI6q4,488
|
|
|
31
31
|
dataflow/models/user.py,sha256=-XEpulg7UAL-WDMyigPasDS61btna2mKtJPsanWA4lw,1108
|
|
32
32
|
dataflow/models/user_environment.py,sha256=yI9NutULcLiwlycuEin6ROe6o1Sjdv_sgw2MEkJFeYg,568
|
|
33
33
|
dataflow/models/user_team.py,sha256=r_fmKvf6JuGgiiI9TXWjVG2QZ3WOvDrOwYWVQ3r8oWo,659
|
|
34
|
-
dataflow/models/variables.py,sha256=
|
|
34
|
+
dataflow/models/variables.py,sha256=thWqX9KbR2x0oBI-bVcW5TV1eKf0TYNxgGmZWTUs2g4,1414
|
|
35
35
|
dataflow/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
dataflow/schemas/connection.py,sha256=
|
|
36
|
+
dataflow/schemas/connection.py,sha256=ut2sqz06yOjmFKzHry92FEt7DN09Bj30GYse35__Cuw,2467
|
|
37
37
|
dataflow/schemas/git_ssh.py,sha256=N1O7HM6ZbygIBZn2rKvNR0e7IM3ZJMAH6aJtjaghDr0,1283
|
|
38
|
-
dataflow/schemas/secret.py,sha256=
|
|
38
|
+
dataflow/schemas/secret.py,sha256=wMSCn6zoBHS-R4NoKwljq2JUad8p9JY542UNJFa86X8,1183
|
|
39
39
|
dataflow/scripts/clone_environment.sh,sha256=Qy0GylsA3kUVUL_L1MirxIWujOFhT1tikKqXNtCTWd4,506
|
|
40
40
|
dataflow/scripts/create_environment.sh,sha256=3FHgNplJuEZvyTsLqlCJNX9oyfXgsfqn80VZk2xtvso,828
|
|
41
41
|
dataflow/scripts/update_environment.sh,sha256=2dtn2xlNi6frpig-sqlGE1_IKRbbkqYOCpf_qyMKKII,992
|
|
@@ -50,8 +50,8 @@ dataflow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
50
50
|
dataflow/utils/exceptions.py,sha256=8GRFoYZ5dPGQckVm2znaHpPi0ZAs69fK-RGKukEsapk,4432
|
|
51
51
|
dataflow/utils/get_current_user.py,sha256=4nSO3SPVMZhW-MsIgxR3f9ZzrFaIZIuyrM6hvfyE7PQ,1202
|
|
52
52
|
dataflow/utils/logger.py,sha256=7BFrOq5Oiqn8P4XZbgJzMP5O07d2fpdECbbfsjrUuHw,1213
|
|
53
|
-
dataflow_core-2.1.
|
|
54
|
-
dataflow_core-2.1.
|
|
55
|
-
dataflow_core-2.1.
|
|
56
|
-
dataflow_core-2.1.
|
|
57
|
-
dataflow_core-2.1.
|
|
53
|
+
dataflow_core-2.1.14.dist-info/METADATA,sha256=er2J0BBiZuIgOJJH5yG0mLhVQ81D6qrhHZOad_dYPLE,370
|
|
54
|
+
dataflow_core-2.1.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
55
|
+
dataflow_core-2.1.14.dist-info/entry_points.txt,sha256=ppj_EIbYrJJwCPg1kfdsZk5q1N-Ejfis1neYrnjhO8o,117
|
|
56
|
+
dataflow_core-2.1.14.dist-info/top_level.txt,sha256=SZsUOpSCK9ntUy-3Tusxzf5A2e8ebwD8vouPb1dPt_8,23
|
|
57
|
+
dataflow_core-2.1.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|