mostlyai 4.4.6__tar.gz → 4.4.7__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.
- {mostlyai-4.4.6 → mostlyai-4.4.7}/PKG-INFO +1 -1
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/__init__.py +1 -1
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/base.py +5 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/jobs.py +16 -13
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_finalize_generation.py +15 -3
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_train_model.py +1 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/domain.py +58 -16
- {mostlyai-4.4.6 → mostlyai-4.4.7}/pyproject.toml +1 -1
- {mostlyai-4.4.6 → mostlyai-4.4.7}/.gitignore +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/LICENSE +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/README.md +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/auto_detect.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/base.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/context.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/conversions.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/base.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/bigquery.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/databricks.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/hive.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/mssql.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/mysql.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/oracle.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/postgresql.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/snowflake.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/sqlite.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/dtype.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/exceptions.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/container/aws.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/container/azure.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/container/minio.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/table/csv.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/table/feather.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/table/json.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/file/utils.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/language_model.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/metadata_objects.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/non_context.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/progress_callback.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/pull.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/pull_context.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/pull_utils.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/push.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/util/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/util/common.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_data/util/kerberos.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/cli.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/connectors.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/plan.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/generators.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/progress.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/routes.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/server.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/storage.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/__init__.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/_base_utils.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/_naming_conventions.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/_utils.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/api.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/base.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/connectors.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/exceptions.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/generators.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
- {mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/py.typed +0 -0
|
@@ -513,6 +513,11 @@ class FileContainer(DataContainer):
|
|
|
513
513
|
assert_read_only_sql(sql)
|
|
514
514
|
try:
|
|
515
515
|
with duckdb.connect(database=":memory:") as con:
|
|
516
|
+
con.execute("""
|
|
517
|
+
SET disabled_filesystems = 'LocalFileSystem';
|
|
518
|
+
SET allow_community_extensions = false;
|
|
519
|
+
SET lock_configuration = true;
|
|
520
|
+
""")
|
|
516
521
|
self._init_duckdb(con)
|
|
517
522
|
result = con.execute(sql).fetchdf()
|
|
518
523
|
|
|
@@ -34,6 +34,7 @@ from mostlyai.sdk._local.execution.step_encode_training_data import execute_step
|
|
|
34
34
|
from mostlyai.sdk._local.execution.step_finalize_generation import (
|
|
35
35
|
execute_step_finalize_generation,
|
|
36
36
|
create_generation_schema,
|
|
37
|
+
update_total_rows,
|
|
37
38
|
)
|
|
38
39
|
from mostlyai.sdk._local.execution.step_generate_data import execute_step_generate_data
|
|
39
40
|
from mostlyai.sdk._local.execution.step_generate_model_report_data import (
|
|
@@ -280,17 +281,18 @@ class Execution:
|
|
|
280
281
|
if t.configuration.sample_seed_connector_id is not None
|
|
281
282
|
]
|
|
282
283
|
connectors_dir = self._home_dir / "connectors"
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
284
|
+
if connectors_dir.exists():
|
|
285
|
+
for connector_path in connectors_dir.iterdir():
|
|
286
|
+
if not (connector_path.name in connector_ids and connector_path.is_dir()):
|
|
287
|
+
continue
|
|
288
|
+
|
|
289
|
+
try:
|
|
290
|
+
connector = read_connector_from_json(connector_path)
|
|
291
|
+
if connector.type == ConnectorType.file_upload:
|
|
292
|
+
shutil.rmtree(connector_path)
|
|
293
|
+
except Exception as e:
|
|
294
|
+
_LOG.info(f"Failed to clear connector {connector_path}: {e}")
|
|
295
|
+
pass
|
|
294
296
|
|
|
295
297
|
def run(self):
|
|
296
298
|
# execute job
|
|
@@ -504,7 +506,7 @@ class Execution:
|
|
|
504
506
|
step="finalize_generation",
|
|
505
507
|
)
|
|
506
508
|
|
|
507
|
-
execute_step_finalize_generation(
|
|
509
|
+
usages = execute_step_finalize_generation(
|
|
508
510
|
schema=schema,
|
|
509
511
|
is_probe=False,
|
|
510
512
|
job_workspace_dir=self._job_workspace_dir,
|
|
@@ -514,6 +516,7 @@ class Execution:
|
|
|
514
516
|
step_code=StepCode.finalize_generation,
|
|
515
517
|
),
|
|
516
518
|
)
|
|
519
|
+
update_total_rows(self._synthetic_dataset, usages)
|
|
517
520
|
|
|
518
521
|
def execute_deliver_data(self):
|
|
519
522
|
schema = create_generation_schema(
|
|
@@ -544,7 +547,7 @@ class Execution:
|
|
|
544
547
|
step="finalize_generation",
|
|
545
548
|
)
|
|
546
549
|
# step: FINALIZE_GENERATION
|
|
547
|
-
execute_step_finalize_generation(
|
|
550
|
+
_ = execute_step_finalize_generation(
|
|
548
551
|
schema=schema,
|
|
549
552
|
is_probe=True,
|
|
550
553
|
job_workspace_dir=self._job_workspace_dir,
|
|
@@ -30,7 +30,7 @@ from mostlyai.sdk._data.util.common import (
|
|
|
30
30
|
NON_CONTEXT_COLUMN_INFIX,
|
|
31
31
|
IS_NULL,
|
|
32
32
|
)
|
|
33
|
-
from mostlyai.sdk.domain import Generator
|
|
33
|
+
from mostlyai.sdk.domain import Generator, SyntheticDataset
|
|
34
34
|
|
|
35
35
|
_LOG = logging.getLogger(__name__)
|
|
36
36
|
|
|
@@ -41,7 +41,11 @@ def execute_step_finalize_generation(
|
|
|
41
41
|
is_probe: bool,
|
|
42
42
|
job_workspace_dir: Path,
|
|
43
43
|
update_progress: ProgressCallback | None = None,
|
|
44
|
-
) ->
|
|
44
|
+
) -> dict[str, int]:
|
|
45
|
+
# get synthetic table usage
|
|
46
|
+
usages = dict()
|
|
47
|
+
for table_name, table in schema.tables.items():
|
|
48
|
+
usages.update({table_name: table.row_count})
|
|
45
49
|
# short circuit for probing
|
|
46
50
|
delivery_dir = job_workspace_dir / "FinalizedSyntheticData"
|
|
47
51
|
if is_probe:
|
|
@@ -52,7 +56,7 @@ def execute_step_finalize_generation(
|
|
|
52
56
|
delivery_dir=delivery_dir,
|
|
53
57
|
export_csv=False,
|
|
54
58
|
)
|
|
55
|
-
return
|
|
59
|
+
return usages
|
|
56
60
|
|
|
57
61
|
random_samples_dir = job_workspace_dir / "RandomSamples"
|
|
58
62
|
zip_dir = job_workspace_dir / "ZIP"
|
|
@@ -94,6 +98,14 @@ def execute_step_finalize_generation(
|
|
|
94
98
|
zip_data(delivery_dir=delivery_dir, format="csv", out_dir=zip_dir)
|
|
95
99
|
progress.update(advance=1)
|
|
96
100
|
|
|
101
|
+
return usages
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def update_total_rows(synthetic_dataset: SyntheticDataset, usages: dict[str, int]) -> None:
|
|
105
|
+
for table_name, total_rows in usages.items():
|
|
106
|
+
table = next(t for t in synthetic_dataset.tables if t.name == table_name)
|
|
107
|
+
table.total_rows = total_rows
|
|
108
|
+
|
|
97
109
|
|
|
98
110
|
def format_datetime(df: pd.DataFrame) -> pd.DataFrame:
|
|
99
111
|
for column in df.columns:
|
|
@@ -61,6 +61,7 @@ def execute_step_train_model(
|
|
|
61
61
|
max_training_time=model_config.max_training_time,
|
|
62
62
|
max_epochs=model_config.max_epochs,
|
|
63
63
|
batch_size=model_config.batch_size,
|
|
64
|
+
gradient_accumulation_steps=model_config.gradient_accumulation_steps,
|
|
64
65
|
max_sequence_window=max_sequence_window,
|
|
65
66
|
enable_flexible_generation=model_config.enable_flexible_generation,
|
|
66
67
|
differential_privacy=differential_privacy,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
# generated by datamodel-codegen:
|
|
16
|
-
# timestamp: 2025-04-
|
|
16
|
+
# timestamp: 2025-04-02T12:04:56+00:00
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
@@ -442,10 +442,7 @@ class ConnectorWriteDataConfig(CustomBaseModel):
|
|
|
442
442
|
Configuration for writing data to a connector.
|
|
443
443
|
"""
|
|
444
444
|
|
|
445
|
-
file: bytes = Field(
|
|
446
|
-
...,
|
|
447
|
-
description="Binary Parquet file containing the data to write. If null, a delete data operation occurs.",
|
|
448
|
-
)
|
|
445
|
+
file: bytes = Field(..., description="Binary Parquet file containing the data to write.")
|
|
449
446
|
location: str = Field(
|
|
450
447
|
...,
|
|
451
448
|
description="Specifies the target within the connector to which to write the data. The format of this parameter varies by connector type.",
|
|
@@ -1802,7 +1799,7 @@ class Connector(CustomBaseModel):
|
|
|
1802
1799
|
List connector locations.
|
|
1803
1800
|
|
|
1804
1801
|
List the available databases, schemas, tables, or folders for a connector.
|
|
1805
|
-
For storage connectors, this returns list of folders and files
|
|
1802
|
+
For storage connectors, this returns list of buckets for empty prefix and otherwise the folders and files then within a path, specified via prefix.
|
|
1806
1803
|
For DB connectors, this returns list of schemas (or databases for DBs without schema), respectively list of tables if `prefix` is provided.
|
|
1807
1804
|
|
|
1808
1805
|
The formats of the locations are:
|
|
@@ -1826,25 +1823,42 @@ class Connector(CustomBaseModel):
|
|
|
1826
1823
|
prefix (str): The prefix to filter the results by. Defaults to an empty string.
|
|
1827
1824
|
|
|
1828
1825
|
Returns:
|
|
1829
|
-
list[str]: A list of locations (schemas, databases, directories, etc.).
|
|
1826
|
+
list[str]: A list of locations (schemas, databases, directories, etc.).
|
|
1827
|
+
|
|
1828
|
+
Example:
|
|
1829
|
+
```python
|
|
1830
|
+
c.locations() # list all schemas / databases for a DB connector; list all buckets for a storage connector
|
|
1831
|
+
c.locations('db_name') # list all tables in 'db_name' for a DB connector
|
|
1832
|
+
c.locations('s3://my_bucket') # list all objects in 'my_bucket' for a S3 storage connector
|
|
1833
|
+
c.locations('gs://my_bucket/path/to/folder') # list all objects in 'my_bucket/path/to/folder' for a GCP storage connector
|
|
1834
|
+
c.locations('az://my_container/path/to/folder') # list all objects in 'my_container/path/to/folder' for a AZURE storage connector
|
|
1835
|
+
```
|
|
1836
|
+
"""
|
|
1830
1837
|
return self.client._locations(connector_id=self.id, prefix=prefix)
|
|
1831
1838
|
|
|
1832
1839
|
def schema(self, location: str) -> list[dict[str, Any]]:
|
|
1833
1840
|
"""
|
|
1834
1841
|
Retrieve the schema of the table at a connector location.
|
|
1835
|
-
|
|
1842
|
+
This method is available for all connectors.
|
|
1836
1843
|
|
|
1837
1844
|
Args:
|
|
1838
1845
|
location (str): The location of the table.
|
|
1839
1846
|
|
|
1840
1847
|
Returns:
|
|
1841
1848
|
list[dict[str, Any]]: The retrieved schema.
|
|
1849
|
+
|
|
1850
|
+
Example:
|
|
1851
|
+
```python
|
|
1852
|
+
c.schema('db_name.table_name') # get the schema of 'table_name' in 'db_name' for a DB connector
|
|
1853
|
+
c.schema('s3://my_bucket/path/to/file.csv') # get the schema of 'file.csv' in 'my_bucket' for a S3 storage connector
|
|
1854
|
+
```
|
|
1842
1855
|
"""
|
|
1843
1856
|
return self.client._schema(connector_id=self.id, location=location)
|
|
1844
1857
|
|
|
1845
1858
|
def read_data(self, location: str, limit: int | None = None, shuffle: bool = False) -> pd.DataFrame:
|
|
1846
1859
|
"""
|
|
1847
1860
|
Retrieve data from the specified location within the connector.
|
|
1861
|
+
This method is only available for connectors of access_type READ_DATA or WRITE_DATA.
|
|
1848
1862
|
|
|
1849
1863
|
Args:
|
|
1850
1864
|
location (str): The target location within the connector to read data from.
|
|
@@ -1853,6 +1867,12 @@ class Connector(CustomBaseModel):
|
|
|
1853
1867
|
|
|
1854
1868
|
Returns:
|
|
1855
1869
|
pd.DataFrame: A DataFrame containing the retrieved data.
|
|
1870
|
+
|
|
1871
|
+
Example:
|
|
1872
|
+
```python
|
|
1873
|
+
df = c.read_data('db_name.table_name', limit=100) # fetch first 100 rows from 'table_name' in 'db_name' for a DB connector
|
|
1874
|
+
df = c.read_data('s3://my_bucket/path/to/file.csv') # read all data from 'file.csv' in 'my_bucket' for a S3 storage connector
|
|
1875
|
+
```
|
|
1856
1876
|
"""
|
|
1857
1877
|
return self.client._read_data(connector_id=self.id, location=location, limit=limit, shuffle=shuffle)
|
|
1858
1878
|
|
|
@@ -1864,20 +1884,34 @@ class Connector(CustomBaseModel):
|
|
|
1864
1884
|
) -> None:
|
|
1865
1885
|
"""
|
|
1866
1886
|
Write data to the specified location within the connector.
|
|
1887
|
+
This method is only available for connectors of access_type WRITE_DATA.
|
|
1867
1888
|
|
|
1868
1889
|
Args:
|
|
1869
1890
|
data (pd.DataFrame | None): The DataFrame to write, or None to delete the location.
|
|
1870
1891
|
location (str): The target location within the connector to write data to.
|
|
1871
1892
|
if_exists (Literal["append", "replace", "fail"]): The behavior if the target location already exists (append, replace, fail). Default is "fail".
|
|
1893
|
+
|
|
1894
|
+
Example:
|
|
1895
|
+
```python
|
|
1896
|
+
c.write_data(df, 'db_name.table_name', if_exists='fail') # write data to 'table_name' in 'db_name' for a DB connector (if it doesn't exist)
|
|
1897
|
+
c.write_data(df, 's3://my_bucket/path/to/file.csv') # write data to 'file.csv' in 'my_bucket' for a S3 storage connector
|
|
1898
|
+
```
|
|
1872
1899
|
"""
|
|
1873
1900
|
self.client._write_data(connector_id=self.id, data=data, location=location, if_exists=if_exists)
|
|
1874
1901
|
|
|
1875
1902
|
def delete_data(self, location: str) -> None:
|
|
1876
1903
|
"""
|
|
1877
1904
|
Delete data from the specified location within the connector.
|
|
1905
|
+
This method is only available for connectors of access_type WRITE_DATA.
|
|
1878
1906
|
|
|
1879
1907
|
Args:
|
|
1880
1908
|
location (str): The target location within the connector to delete data from.
|
|
1909
|
+
|
|
1910
|
+
Example:
|
|
1911
|
+
```python
|
|
1912
|
+
c.delete_data('db_name.table_name') # drop table data from 'table_name' in 'db_name' for a DB connector
|
|
1913
|
+
c.delete_data('s3://my_bucket/path/to/file.csv') # delete data from 'file.csv' in 'my_bucket' for a S3 storage connector
|
|
1914
|
+
```
|
|
1881
1915
|
"""
|
|
1882
1916
|
self.client._delete_data(connector_id=self.id, location=location)
|
|
1883
1917
|
|
|
@@ -1886,14 +1920,21 @@ class Connector(CustomBaseModel):
|
|
|
1886
1920
|
Execute a read-only SQL query against the connector's data source.
|
|
1887
1921
|
|
|
1888
1922
|
Queries can include statements like SELECT, SHOW, or DESCRIBE, but must not modify data or state.
|
|
1889
|
-
For file-based connectors (
|
|
1890
|
-
queries are executed using DuckDB.
|
|
1923
|
+
For file-based connectors (S3_STORAGE, GOOGLE_CLOUD_STORAGE, AZURE_STORAGE) queries are executed using DuckDB.
|
|
1891
1924
|
|
|
1892
1925
|
Args:
|
|
1893
1926
|
sql (str): The SQL query to execute.
|
|
1894
1927
|
|
|
1895
1928
|
Returns:
|
|
1896
1929
|
pd.DataFrame: The result of the query as a Pandas DataFrame.
|
|
1930
|
+
|
|
1931
|
+
Example:
|
|
1932
|
+
```python
|
|
1933
|
+
df = c.query("SELECT count(*) FROM schema.table") # for DB connectors
|
|
1934
|
+
df = c.query("SELECT count(*) FROM read_csv_auto('s3://bucket/path/to/file.csv')") # query a single CSV file from S3 storage
|
|
1935
|
+
df = c.query("SELECT count(*) FROM read_parquet('gs://bucket/path/to/folder/*.parquet')") # query a folder with PQT files from GCP storage
|
|
1936
|
+
df = c.query("SELECT count(*) FROM read_json('az://bucket/path/to/file.json')") # query a single JSON file from AZURE storage
|
|
1937
|
+
```
|
|
1897
1938
|
"""
|
|
1898
1939
|
return self.client._query(connector_id=self.id, sql=sql)
|
|
1899
1940
|
|
|
@@ -2034,35 +2075,36 @@ class ModelConfiguration(CustomBaseModel):
|
|
|
2034
2075
|
alias="maxSampleSize",
|
|
2035
2076
|
description="The maximum number of samples to consider for training.\nIf not provided, then all available samples will be taken.\n",
|
|
2036
2077
|
ge=1,
|
|
2037
|
-
le=1000000000,
|
|
2038
2078
|
)
|
|
2039
2079
|
batch_size: int | None = Field(
|
|
2040
2080
|
None,
|
|
2041
2081
|
alias="batchSize",
|
|
2042
|
-
description="The batch size used for training the model.\nIf not provided, batchSize will be chosen automatically.\n",
|
|
2082
|
+
description="The physical batch size used for training the model.\nIf not provided, batchSize will be chosen automatically.\n",
|
|
2083
|
+
ge=1,
|
|
2084
|
+
)
|
|
2085
|
+
gradient_accumulation_steps: int | None = Field(
|
|
2086
|
+
None,
|
|
2087
|
+
alias="gradientAccumulationSteps",
|
|
2088
|
+
description="Steps to accumulate gradients before optimizer update.\nIf not provided, gradientAccumulationSteps will be chosen automatically.\n",
|
|
2043
2089
|
ge=1,
|
|
2044
|
-
le=1000000,
|
|
2045
2090
|
)
|
|
2046
2091
|
max_training_time: float | None = Field(
|
|
2047
2092
|
14400,
|
|
2048
2093
|
alias="maxTrainingTime",
|
|
2049
2094
|
description="The maximum number of minutes to train the model.",
|
|
2050
2095
|
ge=0.0,
|
|
2051
|
-
le=1000000.0,
|
|
2052
2096
|
)
|
|
2053
2097
|
max_epochs: float | None = Field(
|
|
2054
2098
|
100,
|
|
2055
2099
|
alias="maxEpochs",
|
|
2056
2100
|
description="The maximum number of epochs to train the model.",
|
|
2057
2101
|
ge=0.0,
|
|
2058
|
-
le=1000000.0,
|
|
2059
2102
|
)
|
|
2060
2103
|
max_sequence_window: int | None = Field(
|
|
2061
2104
|
100,
|
|
2062
2105
|
alias="maxSequenceWindow",
|
|
2063
2106
|
description="The maximum sequence window to consider for training.\nOnly applicable for TABULAR models.\n",
|
|
2064
2107
|
ge=1,
|
|
2065
|
-
le=100000,
|
|
2066
2108
|
)
|
|
2067
2109
|
enable_flexible_generation: bool | None = Field(
|
|
2068
2110
|
True,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_analyze_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_encode_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.4.6 → mostlyai-4.4.7}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|