mostlyai 6.1.4__tar.gz → 6.2.0__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 (90) hide show
  1. {mostlyai-6.1.4 → mostlyai-6.2.0}/PKG-INFO +7 -9
  2. {mostlyai-6.1.4 → mostlyai-6.2.0}/README.md +2 -2
  3. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/__init__.py +1 -1
  4. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/context.py +10 -3
  5. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/conversions.py +0 -2
  6. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/base.py +4 -0
  7. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/metadata_objects.py +0 -5
  8. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/api.py +0 -9
  9. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/domain.py +0 -12
  10. {mostlyai-6.1.4 → mostlyai-6.2.0}/pyproject.toml +5 -9
  11. mostlyai-6.1.4/mostlyai/sdk/_data/db/snowflake.py +0 -109
  12. {mostlyai-6.1.4 → mostlyai-6.2.0}/.gitignore +0 -0
  13. {mostlyai-6.1.4 → mostlyai-6.2.0}/LICENSE +0 -0
  14. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/__init__.py +0 -0
  15. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/auto_detect.py +0 -0
  16. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/base.py +0 -0
  17. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/constraints/transformations.py +0 -0
  18. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/constraints/types/__init__.py +0 -0
  19. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/constraints/types/base.py +0 -0
  20. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/constraints/types/fixed_combinations.py +0 -0
  21. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/constraints/types/inequality.py +0 -0
  22. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/__init__.py +0 -0
  23. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/base.py +0 -0
  24. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  25. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/mssql.py +0 -0
  26. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/mysql.py +0 -0
  27. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/oracle.py +0 -0
  28. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  29. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  30. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  31. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/dtype.py +0 -0
  32. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/exceptions.py +0 -0
  33. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/__init__.py +0 -0
  34. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  35. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  36. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  37. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  38. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  39. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  40. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  41. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  42. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  43. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/table/json.py +0 -0
  44. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  45. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/file/utils.py +0 -0
  46. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/language_model.py +0 -0
  47. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/non_context.py +0 -0
  48. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/progress_callback.py +0 -0
  49. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/pull.py +0 -0
  50. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/pull_context.py +0 -0
  51. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/pull_utils.py +0 -0
  52. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/push.py +0 -0
  53. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/util/__init__.py +0 -0
  54. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_data/util/common.py +0 -0
  55. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/__init__.py +0 -0
  56. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/cli.py +0 -0
  57. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/connectors.py +0 -0
  58. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/docker_entrypoint.py +0 -0
  59. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  60. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  61. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/migration.py +0 -0
  62. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/plan.py +0 -0
  63. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  64. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  65. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  66. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  67. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  68. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  69. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  70. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  71. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  72. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  73. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  74. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/generators.py +0 -0
  75. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/progress.py +0 -0
  76. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/routes.py +0 -0
  77. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/server.py +0 -0
  78. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/storage.py +0 -0
  79. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  80. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/__init__.py +0 -0
  81. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/_base_utils.py +0 -0
  82. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/_constraint_types.py +0 -0
  83. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  84. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/_utils.py +0 -0
  85. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/base.py +0 -0
  86. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/connectors.py +0 -0
  87. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/exceptions.py +0 -0
  88. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/generators.py +0 -0
  89. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  90. {mostlyai-6.1.4 → mostlyai-6.2.0}/mostlyai/sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mostlyai
3
- Version: 6.1.4
3
+ Version: 6.2.0
4
4
  Summary: Synthetic Data SDK
5
5
  Project-URL: homepage, https://mostly.ai/
6
6
  Project-URL: repository, https://github.com/mostly-ai/mostlyai
@@ -53,8 +53,8 @@ Requires-Dist: fastapi>=0.116.0; extra == 'local'
53
53
  Requires-Dist: filelock>=3.16.1; extra == 'local'
54
54
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local'
55
55
  Requires-Dist: joblib>=1.4.2; extra == 'local'
56
- Requires-Dist: mostlyai-engine==2.7.0; extra == 'local'
57
- Requires-Dist: mostlyai-qa==1.10.8; extra == 'local'
56
+ Requires-Dist: mostlyai-engine==2.7.3; extra == 'local'
57
+ Requires-Dist: mostlyai-qa==1.10.11; extra == 'local'
58
58
  Requires-Dist: networkx<4,>=3.0; extra == 'local'
59
59
  Requires-Dist: openpyxl>=3.1.5; extra == 'local'
60
60
  Requires-Dist: python-multipart>=0.0.20; extra == 'local'
@@ -75,8 +75,8 @@ Requires-Dist: fastapi>=0.116.0; extra == 'local-gpu'
75
75
  Requires-Dist: filelock>=3.16.1; extra == 'local-gpu'
76
76
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local-gpu'
77
77
  Requires-Dist: joblib>=1.4.2; extra == 'local-gpu'
78
- Requires-Dist: mostlyai-engine[gpu]==2.7.0; extra == 'local-gpu'
79
- Requires-Dist: mostlyai-qa==1.10.8; extra == 'local-gpu'
78
+ Requires-Dist: mostlyai-engine[gpu]==2.7.3; extra == 'local-gpu'
79
+ Requires-Dist: mostlyai-qa==1.10.11; extra == 'local-gpu'
80
80
  Requires-Dist: networkx<4,>=3.0; extra == 'local-gpu'
81
81
  Requires-Dist: openpyxl>=3.1.5; extra == 'local-gpu'
82
82
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
@@ -97,8 +97,6 @@ Provides-Extra: oracle
97
97
  Requires-Dist: oracledb>=2.2.1; extra == 'oracle'
98
98
  Provides-Extra: postgres
99
99
  Requires-Dist: psycopg2<3,>=2.9.4; extra == 'postgres'
100
- Provides-Extra: snowflake
101
- Requires-Dist: snowflake-sqlalchemy<2,>=1.6.1; extra == 'snowflake'
102
100
  Description-Content-Type: text/markdown
103
101
 
104
102
  # Synthetic Data SDK ✨
@@ -330,10 +328,10 @@ uv pip install -U mostlyai
330
328
 
331
329
  ### Data Connectors
332
330
 
333
- Add any of the following extras for further data connectors support in LOCAL mode: `googlebigquery`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
331
+ Add any of the following extras for further data connectors support in LOCAL mode: `googlebigquery`, `mssql`, `mysql`, `oracle`, `postgres`. E.g.
334
332
 
335
333
  ```shell
336
- uv pip install -U 'mostlyai[local, snowflake]'
334
+ uv pip install -U 'mostlyai[local, postgres]'
337
335
  ```
338
336
 
339
337
  ### Using Docker
@@ -227,10 +227,10 @@ uv pip install -U mostlyai
227
227
 
228
228
  ### Data Connectors
229
229
 
230
- Add any of the following extras for further data connectors support in LOCAL mode: `googlebigquery`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
230
+ Add any of the following extras for further data connectors support in LOCAL mode: `googlebigquery`, `mssql`, `mysql`, `oracle`, `postgres`. E.g.
231
231
 
232
232
  ```shell
233
- uv pip install -U 'mostlyai[local, snowflake]'
233
+ uv pip install -U 'mostlyai[local, postgres]'
234
234
  ```
235
235
 
236
236
  ### Using Docker
@@ -47,4 +47,4 @@ For more information, visit: https://mostly-ai.github.io/mostlyai/
47
47
  from mostlyai.sdk.client.api import MostlyAI
48
48
 
49
49
  __all__ = ["MostlyAI"]
50
- __version__ = "6.1.4" # Do not set this manually. Use poetry version [params].
50
+ __version__ = "6.2.0" # Do not set this manually. Use poetry version [params].
@@ -105,9 +105,16 @@ def add_ns_context(
105
105
 
106
106
  # create list of the previous values and insert that column adjacent to the current column
107
107
  _LOG.info(f"max_ns_prev_len: {MAX_NS_PREV_LEN}")
108
- prev_ser = (
109
- ctx_data[[root_key, cur_name]].groupby(root_key).apply(add_previous_values_ctx)[prev_name].droplevel(0)
110
- ).apply(lambda x: x[:-MAX_NS_PREV_LEN])
108
+ if ctx_data.empty:
109
+ # Preserve the context schema even when this chunk has no parent rows.
110
+ prev_ser = pd.Series(index=ctx_data.index, dtype=object)
111
+ else:
112
+ prev_ser = (
113
+ ctx_data[[root_key, cur_name]]
114
+ .groupby(root_key)
115
+ .apply(add_previous_values_ctx)[prev_name]
116
+ .droplevel(0)
117
+ ).apply(lambda x: x[:-MAX_NS_PREV_LEN])
111
118
  ctx_data.insert(loc=ctx_data.columns.get_loc(cur_name), column=prev_name, value=prev_ser)
112
119
  ns_columns.append(prev_name)
113
120
  _LOG.info(f"NS was applied, adding the following columns: {ns_columns}")
@@ -29,7 +29,6 @@ CONNECTOR_TYPE_CONTAINER_CLASS_MAP = {
29
29
  ConnectorType.mssql: "mostlyai.sdk._data.db.mssql.MssqlContainer",
30
30
  ConnectorType.oracle: "mostlyai.sdk._data.db.oracle.OracleContainer",
31
31
  ConnectorType.mariadb: "mostlyai.sdk._data.db.mysql.MariadbContainer",
32
- ConnectorType.snowflake: "mostlyai.sdk._data.db.snowflake.SnowflakeContainer",
33
32
  ConnectorType.bigquery: "mostlyai.sdk._data.db.bigquery.BigQueryContainer",
34
33
  ConnectorType.sqlite: "mostlyai.sdk._data.db.sqlite.SqliteContainer",
35
34
  ConnectorType.azure_storage: "mostlyai.sdk._data.file.container.azure.AzureBlobFileContainer",
@@ -44,7 +43,6 @@ CONNECTOR_TYPE_CONTAINER_PARAMS_CLASS_MAP = {
44
43
  ConnectorType.mssql: "mostlyai.sdk._data.metadata_objects.SqlAlchemyContainerParameters",
45
44
  ConnectorType.oracle: "mostlyai.sdk._data.metadata_objects.OracleContainerParameters",
46
45
  ConnectorType.mariadb: "mostlyai.sdk._data.metadata_objects.SqlAlchemyContainerParameters",
47
- ConnectorType.snowflake: "mostlyai.sdk._data.metadata_objects.SnowflakeContainerParameters",
48
46
  ConnectorType.bigquery: "mostlyai.sdk._data.metadata_objects.BigQueryContainerParameters",
49
47
  ConnectorType.sqlite: "mostlyai.sdk._data.metadata_objects.SqlAlchemyContainerParameters",
50
48
  ConnectorType.azure_storage: "mostlyai.sdk._data.metadata_objects.AzureBlobFileContainerParameters",
@@ -212,6 +212,10 @@ class FileDataTable(DataTable, abc.ABC):
212
212
  if field_type == pa.null():
213
213
  # handle empty or null-only columns
214
214
  values = [None] if None in values else []
215
+ if not values:
216
+ # Keep the field type: Arrow otherwise infers an empty IN-list as null.
217
+ filters.append(ds.field(c).isin(pa.array([], type=field_type)))
218
+ continue
215
219
  if are_types_compatible(field_type, values):
216
220
  field_c = ds.field(c)
217
221
  else:
@@ -98,11 +98,6 @@ class OracleContainerParameters(SqlAlchemyContainerParameters):
98
98
  connection_type: Nullable[str] = Field("SID")
99
99
 
100
100
 
101
- class SnowflakeContainerParameters(SqlAlchemyContainerParameters):
102
- host: Nullable[str] = Field(None, alias="warehouse")
103
- account: Nullable[str] = None
104
-
105
-
106
101
  class BigQueryContainerParameters(SqlAlchemyContainerParameters):
107
102
  password: Nullable[str] = Field(None, validation_alias=AliasChoices("keyFile", "key_file"))
108
103
 
@@ -299,15 +299,6 @@ class MostlyAI(_MostlyBaseClient):
299
299
  rootCertificate: base64-encoded string
300
300
  sslCertificate: base64-encoded string
301
301
  sslCertificateKey: base64-encoded string
302
-
303
- - type: SNOWFLAKE
304
- config:
305
- account: string
306
- username: string
307
- warehouse: string, default: COMPUTE_WH
308
- database: string
309
- secrets:
310
- password: string
311
302
  ```
312
303
  """
313
304
  c = self.connectors.create(config=config, test_connection=test_connection)
@@ -59,7 +59,6 @@ class ConnectorType(str, Enum):
59
59
  - `MSSQL`: Microsoft SQL Server database
60
60
  - `ORACLE`: Oracle database
61
61
  - `MARIADB`: MariaDB database
62
- - `SNOWFLAKE`: Snowflake cloud data platform
63
62
  - `BIGQUERY`: Google BigQuery cloud data warehouse
64
63
  - `SQLITE`: SQLite database
65
64
  - `AZURE_STORAGE`: Azure Blob Storage
@@ -74,7 +73,6 @@ class ConnectorType(str, Enum):
74
73
  mssql = "MSSQL"
75
74
  oracle = "ORACLE"
76
75
  mariadb = "MARIADB"
77
- snowflake = "SNOWFLAKE"
78
76
  bigquery = "BIGQUERY"
79
77
  sqlite = "SQLITE"
80
78
  azure_storage = "AZURE_STORAGE"
@@ -169,15 +167,6 @@ class ConnectorConfig(CustomBaseModel):
169
167
  sslCertificate: base64-encoded string
170
168
  sslCertificateKey: base64-encoded string
171
169
 
172
- - type: SNOWFLAKE
173
- config:
174
- account: string
175
- username: string
176
- warehouse: string, default: COMPUTE_WH
177
- database: string
178
- secrets:
179
- password: string
180
-
181
170
  - type: SQLITE
182
171
  config:
183
172
  database: string
@@ -991,7 +980,6 @@ class Connector(CustomBaseModel):
991
980
  - `MYSQL`: `database.table`
992
981
  - `ORACLE`: `schema.table`
993
982
  - `POSTGRES`: `schema.table`
994
- - `SNOWFLAKE`: `schema.table`
995
983
 
996
984
  Args:
997
985
  prefix (str): The prefix to filter the results by. Defaults to an empty string.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "6.1.4"
3
+ version = "6.2.0"
4
4
  description = "Synthetic Data SDK"
5
5
  requires-python = ">=3.11,<3.14"
6
6
  readme = "README.md"
@@ -48,8 +48,8 @@ dependencies = [
48
48
  local = [
49
49
  # "mostlyai-engine @ git+https://github.com/mostly-ai/mostlyai-engine.git@main", # for development
50
50
  # "mostlyai-qa @ git+https://github.com/mostly-ai/mostlyai-qa.git@main", # for development
51
- "mostlyai-engine==2.7.0", # for release (PyPI)
52
- "mostlyai-qa==1.10.8", # for release (PyPI)
51
+ "mostlyai-engine==2.7.3", # for release (PyPI)
52
+ "mostlyai-qa==1.10.11", # for release (PyPI)
53
53
  "fastapi>=0.116.0",
54
54
  "uvicorn>=0.34.0",
55
55
  "python-multipart>=0.0.20",
@@ -74,8 +74,8 @@ local = [
74
74
  local-gpu = [
75
75
  # "mostlyai-engine[gpu] @ git+https://github.com/mostly-ai/mostlyai-engine.git@main", # for development
76
76
  # "mostlyai-qa @ git+https://github.com/mostly-ai/mostlyai-qa.git@main", # for development
77
- "mostlyai-engine[gpu]==2.7.0", # for release (PyPI)
78
- "mostlyai-qa==1.10.8", # for release (PyPI)
77
+ "mostlyai-engine[gpu]==2.7.3", # for release (PyPI)
78
+ "mostlyai-qa==1.10.11", # for release (PyPI)
79
79
  "fastapi>=0.116.0",
80
80
  "uvicorn>=0.34.0",
81
81
  "python-multipart>=0.0.20",
@@ -113,10 +113,6 @@ oracle = [
113
113
  postgres = [
114
114
  "psycopg2>=2.9.4,<3"
115
115
  ]
116
- snowflake = [
117
- "snowflake-sqlalchemy>=1.6.1,<2"
118
- ]
119
-
120
116
  [dependency-groups]
121
117
  dev = [
122
118
  "pytest>=8.0",
@@ -1,109 +0,0 @@
1
- # Copyright 2025 MOSTLY AI
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- import logging
16
- from urllib.parse import quote
17
-
18
- import sqlalchemy as sa
19
- from snowflake.sqlalchemy import URL
20
- from snowflake.sqlalchemy.snowdialect import SnowflakeDialect
21
-
22
- from mostlyai.sdk._data.db.base import DBDType, SqlAlchemyContainer, SqlAlchemyTable
23
- from mostlyai.sdk._data.exceptions import MostlyDataException
24
-
25
- _LOG = logging.getLogger(__name__)
26
-
27
- ACCOUNT_SUFFIX_TO_REMOVE = ".snowflakecomputing.com"
28
- ACCOUNT_PREFIX_TO_REMOVE = "https://"
29
- DEFAULT_WAREHOUSE = "COMPUTE_WH"
30
-
31
-
32
- class SnowflakeDType(DBDType):
33
- @classmethod
34
- def sa_dialect_class(cls):
35
- return SnowflakeDialect
36
-
37
-
38
- class SnowflakeContainer(SqlAlchemyContainer):
39
- SCHEMES = ["snowflake"]
40
- INIT_DEFAULT_VALUES = {"dbname": ""}
41
-
42
- def __init__(self, *args, account, **kwargs):
43
- super().__init__(*args, **kwargs)
44
- self.account = account
45
-
46
- @property
47
- def sa_uri(self):
48
- # User and password are needed to avoid double-encoding of @ character
49
- username = quote(self.username)
50
- password = quote(self.password)
51
- self.host = self.host or DEFAULT_WAREHOUSE
52
- return URL(
53
- user=username,
54
- password=password,
55
- account=self.account.replace(ACCOUNT_SUFFIX_TO_REMOVE, "").replace(ACCOUNT_PREFIX_TO_REMOVE, ""),
56
- warehouse=self.host,
57
- database=self.dbname,
58
- cache_column_metadata=True,
59
- )
60
-
61
- @classmethod
62
- def table_class(cls):
63
- return SnowflakeTable
64
-
65
- def does_database_exist(self) -> bool:
66
- with self.init_sa_connection("db_exist_check") as connection:
67
- result = connection.execute(sa.text(f"SHOW DATABASES LIKE '{self.dbname}'"))
68
- if result.rowcount:
69
- db_exist = True
70
- else:
71
- db_exist = False
72
- return db_exist
73
-
74
- def _is_schema_exist(self) -> bool:
75
- if self.dbschema is None:
76
- return True
77
- with self.use_sa_engine() as sa_engine:
78
- schema_names = sa.inspect(sa_engine).get_schema_names()
79
- return self.dbschema.lower() in schema_names
80
-
81
- def is_accessible(self) -> bool:
82
- try:
83
- with self.init_sa_connection("access_check"):
84
- if self.dbname and not self.does_database_exist():
85
- raise MostlyDataException(f"Database `{self.dbname}` does not exist.")
86
- elif self.schema and not self._is_schema_exist():
87
- raise MostlyDataException(f"Schema `{self.dbschema}` does not exist.")
88
- else:
89
- return True
90
- except sa.exc.SQLAlchemyError as e:
91
- error_message = str(e).lower()
92
- _LOG.error(f"Database connection failed with error: {e}")
93
- if "password" in error_message or "user" or ("account name" and "snowflake") in error_message:
94
- raise MostlyDataException("Credentials are incorrect.")
95
- else:
96
- raise
97
-
98
-
99
- class SnowflakeTable(SqlAlchemyTable):
100
- DATA_TABLE_TYPE = "snowflake"
101
- SA_RANDOM = sa.func.random()
102
-
103
- @classmethod
104
- def dtype_class(cls):
105
- return SnowflakeDType
106
-
107
- @classmethod
108
- def container_class(cls):
109
- return SnowflakeContainer
File without changes
File without changes
File without changes