adapta 5.2.2__tar.gz → 5.2.3__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.
- {adapta-5.2.2 → adapta-5.2.3}/PKG-INFO +1 -1
- {adapta-5.2.2 → adapta-5.2.3}/pyproject.toml +1 -1
- {adapta-5.2.2 → adapta-5.2.3}/pyproject.toml.orig +1 -1
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/cassandra_client/_client.py +79 -26
- {adapta-5.2.2 → adapta-5.2.3}/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/_version.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/connectors/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/connectors/service_bus/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/connectors/service_bus/_connector.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/dataclass/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/dataclass/dataclass_abstract.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/dataclass/dataclass_core.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation_abstract.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation_polars.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation_utils.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/_async_logger.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/_base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/_internal.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/_internal_logger.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/_logger_interface.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/handlers/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/handlers/datadog_api_handler.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/handlers/safe_stream_handler.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/models/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/models/_log_level.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/models/_logs_metadata.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/providers/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/logs/providers/void_logger.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/metrics/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/metrics/_base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/metrics/providers/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/metrics/providers/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/metrics/providers/datadog_provider.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/metrics/providers/void_provider.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/ml/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/ml/_model.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/ml/mlflow/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/ml/mlflow/_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/ml/mlflow/_functions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/process_communication/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/process_communication/_models.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/schema_management/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/schema_management/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/schema_management/schema_entity.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/_azure_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/_base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/_local_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/aws/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/aws/_aws_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/aws/_aws_credentials.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/hashicorp_vault_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/kubernetes_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/oidc_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/token_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/blob/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/blob/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/blob/azure_storage_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/blob/base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/blob/local_storage_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/blob/s3_storage_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/cache/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/cache/_base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/cache/redis_cache.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/azure_sql.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/models/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/models/_models.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/odbc.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/snowflake_sql.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/database/v3/trino_sql.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/delta_lake/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/delta_lake/v3/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/delta_lake/v3/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/delta_lake/v3/_functions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/delta_lake/v3/_models.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/aws_keyspaces/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/aws_keyspaces/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/aws_keyspaces/keyspace_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/aws_keyspaces/keyspaces-certificate.pem +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/cassandra_client/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/cassandra_client/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/cassandra_client/_client_configuration.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/cassandra_client/_model_mappers.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/datastax_astra/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/datastax_astra/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/datastax_astra/_models.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/datastax_astra/astra_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/vanilla_cassandra/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/vanilla_cassandra/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/vanilla_cassandra/vanilla_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/exceptions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/iceberg/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/iceberg/v1/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/iceberg/v1/_functions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/iceberg/v1/_models.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/_functions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/astra.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/aws.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/azure.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/cassandra.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/enum.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/arrow_filter_expression.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/cassandra_filter_expression.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/filter_expression.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/iceberg_filter_expression.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/trino_filter_expression.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/format.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/dict.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/exceptions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/metaframe.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/pandas.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/pickle.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/polars.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/formatters/unit.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/hive.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/iceberg.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/local.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/trino.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_functions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_models.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_qes_astra.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_qes_delta.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_qes_iceberg.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_qes_local.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/_qes_trino.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/parameters/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/parameters/_base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/parameters/_read_parameters.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/parameters/_write_parameters.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/secrets/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/secrets/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/secrets/_base.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/secrets/azure_secret_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/secrets/hashicorp_vault_secret_storage_client.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/sync/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/sync/iceberg_to_cass.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/README.md +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/_common.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/_requests.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/concurrent_task_runner.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/data_structures/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/data_structures/_functions.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/decorators/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/decorators/_logging.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/decorators/_rate_limit.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/metaframe.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/polars.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/python_typing/__init__.py +0 -0
- {adapta-5.2.2 → adapta-5.2.3}/src/adapta/utils/python_typing/_functions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adapta
|
|
3
|
-
Version: 5.2.
|
|
3
|
+
Version: 5.2.3
|
|
4
4
|
Summary: Logging, data connectors, monitoring, secret handling and general lifehacks to make data people lives easier.
|
|
5
5
|
Author: ECCO Data & AI
|
|
6
6
|
Author-email: ECCO Data & AI <esdsupport@ecco.com>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "adapta"
|
|
3
|
-
version = "5.2.
|
|
3
|
+
version = "5.2.3"
|
|
4
4
|
description = "Logging, data connectors, monitoring, secret handling and general lifehacks to make data people lives easier."
|
|
5
5
|
authors = [{ name = "ECCO Data & AI", email = "esdsupport@ecco.com" }]
|
|
6
6
|
requires-python = ">=3.11, <3.16"
|
|
@@ -7,8 +7,12 @@ import uuid
|
|
|
7
7
|
|
|
8
8
|
from cassandra.cqlengine.connection import set_session
|
|
9
9
|
from cassandra.cqlengine.management import sync_table
|
|
10
|
+
from cassandra.query import PreparedStatement
|
|
10
11
|
|
|
11
|
-
from adapta.storage.distributed_object_store.v3.cassandra_client._model_mappers import
|
|
12
|
+
from adapta.storage.distributed_object_store.v3.cassandra_client._model_mappers import (
|
|
13
|
+
CassandraModelMapper,
|
|
14
|
+
get_mapper,
|
|
15
|
+
)
|
|
12
16
|
|
|
13
17
|
try:
|
|
14
18
|
from _socket import IPPROTO_TCP, TCP_NODELAY, TCP_USER_TIMEOUT
|
|
@@ -61,6 +65,25 @@ from adapta.utils.metaframe import MetaFrame, concat
|
|
|
61
65
|
TCassandraModel = TypeVar("TCassandraModel")
|
|
62
66
|
|
|
63
67
|
|
|
68
|
+
def _prepare_lazy_source(source: polars.LazyFrame | polars.DataFrame) -> polars.LazyFrame:
|
|
69
|
+
"""
|
|
70
|
+
Prepares a Polars LazyFrame or DataFrame, casting any list[struct{"key": ..., "value": ...}] columns to native Map types.
|
|
71
|
+
"""
|
|
72
|
+
lazy_source = source.lazy() if isinstance(source, polars.DataFrame) else source
|
|
73
|
+
schema = lazy_source.collect_schema()
|
|
74
|
+
map_transforms = []
|
|
75
|
+
for col_name, dtype in schema.items():
|
|
76
|
+
if isinstance(dtype, (polars.List, polars.Array)) and isinstance(dtype.inner, polars.Struct):
|
|
77
|
+
fields = {f.name: f.dtype for f in dtype.inner.fields}
|
|
78
|
+
if len(fields) == 2 and "key" in fields and "value" in fields:
|
|
79
|
+
map_transforms.append(polars.col(col_name).cast(polars.Map(fields["key"], fields["value"])))
|
|
80
|
+
|
|
81
|
+
if map_transforms:
|
|
82
|
+
lazy_source = lazy_source.with_columns(*map_transforms)
|
|
83
|
+
|
|
84
|
+
return lazy_source
|
|
85
|
+
|
|
86
|
+
|
|
64
87
|
def _fix_map_type(entity: dict) -> dict:
|
|
65
88
|
"""Polars <2 remaps map<k, v> to list[{"key": ..., "value": ...}]"""
|
|
66
89
|
fixed = {}
|
|
@@ -606,9 +629,40 @@ class CassandraClient(ABC):
|
|
|
606
629
|
ttl=time_to_live,
|
|
607
630
|
)
|
|
608
631
|
|
|
632
|
+
def _prepare_insert_statement(self, table_identifier: str, columns: list[str]) -> PreparedStatement:
|
|
633
|
+
columns_str = ", ".join(columns)
|
|
634
|
+
placeholders = ", ".join(["?" for _ in columns])
|
|
635
|
+
query = f"INSERT INTO {table_identifier} ({columns_str}) VALUES ({placeholders});"
|
|
636
|
+
return self._session.prepare(query)
|
|
637
|
+
|
|
638
|
+
def _build_statements_and_params(
|
|
639
|
+
self,
|
|
640
|
+
rows: list[dict] | polars.LazyFrame,
|
|
641
|
+
table_identifier: str,
|
|
642
|
+
cassandra_mapper: CassandraModelMapper,
|
|
643
|
+
) -> list[tuple[PreparedStatement, tuple]]:
|
|
644
|
+
if isinstance(rows, polars.LazyFrame):
|
|
645
|
+
batch_rows = _prepare_lazy_source(rows)
|
|
646
|
+
batch_columns = [col for col in cassandra_mapper.column_names if col in batch_rows.collect_schema()]
|
|
647
|
+
if not batch_columns:
|
|
648
|
+
return []
|
|
649
|
+
|
|
650
|
+
prepared_rows = batch_rows.select(batch_columns).collect()
|
|
651
|
+
if prepared_rows.is_empty():
|
|
652
|
+
return []
|
|
653
|
+
|
|
654
|
+
prepared_stmt = self._prepare_insert_statement(table_identifier, batch_columns)
|
|
655
|
+
return [(prepared_stmt, row) for row in prepared_rows.iter_rows()]
|
|
656
|
+
|
|
657
|
+
if not rows:
|
|
658
|
+
return []
|
|
659
|
+
|
|
660
|
+
prepared_stmt = self._prepare_insert_statement(table_identifier, cassandra_mapper.column_names)
|
|
661
|
+
return [(prepared_stmt, tuple(row.get(col) for col in cassandra_mapper.column_names)) for row in rows]
|
|
662
|
+
|
|
609
663
|
def upsert_concurrent(
|
|
610
664
|
self,
|
|
611
|
-
rows: list[dict],
|
|
665
|
+
rows: list[dict] | polars.LazyFrame,
|
|
612
666
|
table_name: str,
|
|
613
667
|
entity_type: type[TCassandraModel],
|
|
614
668
|
keyspace: str | None = None,
|
|
@@ -617,7 +671,7 @@ class CassandraClient(ABC):
|
|
|
617
671
|
"""
|
|
618
672
|
Upserts rows concurrently using cassandra.concurrent.execute_concurrent.
|
|
619
673
|
|
|
620
|
-
:param rows: List of dictionaries representing rows to upsert.
|
|
674
|
+
:param rows: List of dictionaries or a Polars LazyFrame representing rows to upsert.
|
|
621
675
|
:param table_name: Table to insert entities into.
|
|
622
676
|
:param entity_type: Entity type to map data model and metadata.
|
|
623
677
|
:param keyspace: Optional keyspace name, if not provided in the client constructor.
|
|
@@ -627,9 +681,6 @@ class CassandraClient(ABC):
|
|
|
627
681
|
"Please connect to Cassandra using connect() or with CassandraClient(...) before calling this method"
|
|
628
682
|
)
|
|
629
683
|
|
|
630
|
-
if not rows:
|
|
631
|
-
return
|
|
632
|
-
|
|
633
684
|
target_keyspace = keyspace or self._keyspace
|
|
634
685
|
|
|
635
686
|
cassandra_mapper = get_mapper(
|
|
@@ -641,11 +692,13 @@ class CassandraClient(ABC):
|
|
|
641
692
|
|
|
642
693
|
table_identifier = f"{target_keyspace}.{target_table_name}" if target_keyspace else target_table_name
|
|
643
694
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
695
|
+
statements_and_params = self._build_statements_and_params(
|
|
696
|
+
rows=rows,
|
|
697
|
+
table_identifier=table_identifier,
|
|
698
|
+
cassandra_mapper=cassandra_mapper,
|
|
699
|
+
)
|
|
700
|
+
if not statements_and_params:
|
|
701
|
+
return
|
|
649
702
|
|
|
650
703
|
concurrency = concurrency or (os.cpu_count() or 1) * 2
|
|
651
704
|
|
|
@@ -657,7 +710,6 @@ class CassandraClient(ABC):
|
|
|
657
710
|
raise_on_giveup=True,
|
|
658
711
|
)
|
|
659
712
|
def _execute_concurrent():
|
|
660
|
-
statements_and_params = [(prepared_stmt, tuple(row.get(col) for col in columns)) for row in rows]
|
|
661
713
|
execute_concurrent(
|
|
662
714
|
self._session,
|
|
663
715
|
statements_and_params,
|
|
@@ -678,7 +730,7 @@ class CassandraClient(ABC):
|
|
|
678
730
|
"""
|
|
679
731
|
Uploads a Polars LazyFrame or DataFrame in batches using upsert_concurrent.
|
|
680
732
|
|
|
681
|
-
Note: Map type
|
|
733
|
+
Note: Map type column adjustments are applied to lazy_source as native Polars Map types.
|
|
682
734
|
|
|
683
735
|
:param source: Polars LazyFrame or DataFrame to upload.
|
|
684
736
|
:param table_name: Table to insert entities into.
|
|
@@ -688,10 +740,10 @@ class CassandraClient(ABC):
|
|
|
688
740
|
:param threads: Maximum number of concurrent statements per batch.
|
|
689
741
|
:return: Total number of rows upserted.
|
|
690
742
|
"""
|
|
691
|
-
lazy_source =
|
|
743
|
+
lazy_source = _prepare_lazy_source(source)
|
|
692
744
|
|
|
693
745
|
@run_time_metrics(metric_name="adapta.cassandra.iceberg_batch_upsert_duration")
|
|
694
|
-
def _upsert_with_metric(entities: list[dict], **kwargs) -> int:
|
|
746
|
+
def _upsert_with_metric(entities: list[dict] | polars.LazyFrame, **kwargs) -> int:
|
|
695
747
|
self.upsert_concurrent(
|
|
696
748
|
rows=entities,
|
|
697
749
|
table_name=kwargs["table_name"],
|
|
@@ -699,22 +751,23 @@ class CassandraClient(ABC):
|
|
|
699
751
|
keyspace=kwargs["keyspace"],
|
|
700
752
|
concurrency=kwargs.get("concurrency"),
|
|
701
753
|
)
|
|
702
|
-
|
|
703
|
-
|
|
754
|
+
row_count = kwargs.get("row_count") or (len(entities) if isinstance(entities, list) else 0)
|
|
755
|
+
self._logger.info("Upserted {rows} rows", rows=row_count)
|
|
756
|
+
return row_count
|
|
704
757
|
|
|
705
758
|
total_rows = 0
|
|
706
759
|
for batch in lazy_source.collect_batches(chunk_size=batch_size, maintain_order=False):
|
|
707
|
-
rows = [_fix_map_type(row) for row in batch.to_dicts()]
|
|
708
760
|
_upsert_with_metric(
|
|
709
|
-
|
|
761
|
+
batch.lazy(),
|
|
710
762
|
table_name=table_name,
|
|
711
763
|
entity_type=entity_type,
|
|
712
764
|
keyspace=keyspace,
|
|
713
765
|
concurrency=threads,
|
|
766
|
+
row_count=batch.height,
|
|
714
767
|
metrics_provider=self._metrics_provider,
|
|
715
768
|
logger=self._logger,
|
|
716
769
|
)
|
|
717
|
-
total_rows +=
|
|
770
|
+
total_rows += batch.height
|
|
718
771
|
|
|
719
772
|
return total_rows
|
|
720
773
|
|
|
@@ -730,7 +783,7 @@ class CassandraClient(ABC):
|
|
|
730
783
|
"""
|
|
731
784
|
Uploads a Polars LazyFrame or DataFrame concurrently using Cassandra batch upserts and ConcurrentTaskRunner.
|
|
732
785
|
|
|
733
|
-
Note: Map type
|
|
786
|
+
Note: Map type column adjustments are applied to lazy_source as native Polars Map types.
|
|
734
787
|
|
|
735
788
|
:param source: Polars LazyFrame or DataFrame to upload.
|
|
736
789
|
:param table_name: Table to insert entities into.
|
|
@@ -739,7 +792,7 @@ class CassandraClient(ABC):
|
|
|
739
792
|
:param batch_size: Number of rows per batch to collect and upsert. Defaults to 1,000.
|
|
740
793
|
:param threads: Number of parallel threads to use. Defaults to 4.
|
|
741
794
|
"""
|
|
742
|
-
lazy_source =
|
|
795
|
+
lazy_source = _prepare_lazy_source(source)
|
|
743
796
|
|
|
744
797
|
@run_time_metrics(metric_name="adapta.cassandra.iceberg_batch_upsert_duration")
|
|
745
798
|
def _upsert_with_metric(entities: list[dict], **kwargs) -> int:
|
|
@@ -759,7 +812,7 @@ class CassandraClient(ABC):
|
|
|
759
812
|
_upsert_with_metric,
|
|
760
813
|
str(uuid.uuid4()),
|
|
761
814
|
kwargs={
|
|
762
|
-
"entities":
|
|
815
|
+
"entities": source_batch.to_dicts(),
|
|
763
816
|
"entity_type": entity_type,
|
|
764
817
|
"keyspace": keyspace or self._keyspace,
|
|
765
818
|
"table_name": table_name,
|
|
@@ -786,7 +839,7 @@ class CassandraClient(ABC):
|
|
|
786
839
|
"""
|
|
787
840
|
Deletes entities in batches from a Polars LazyFrame or DataFrame concurrently using ConcurrentTaskRunner.
|
|
788
841
|
|
|
789
|
-
Note: Map type
|
|
842
|
+
Note: Map type column adjustments are applied to lazy_source as native Polars Map types.
|
|
790
843
|
|
|
791
844
|
:param source: Polars LazyFrame or DataFrame containing entities to delete.
|
|
792
845
|
:param table_name: Table to delete entities from.
|
|
@@ -795,7 +848,7 @@ class CassandraClient(ABC):
|
|
|
795
848
|
:param batch_size: Number of rows per batch to collect and delete. Defaults to 1,000.
|
|
796
849
|
:param threads: Number of parallel threads to use. Defaults to 4.
|
|
797
850
|
"""
|
|
798
|
-
lazy_source =
|
|
851
|
+
lazy_source = _prepare_lazy_source(source)
|
|
799
852
|
|
|
800
853
|
target_keyspace = keyspace or self._keyspace
|
|
801
854
|
cassandra_mapper = get_mapper(
|
|
@@ -823,7 +876,7 @@ class CassandraClient(ABC):
|
|
|
823
876
|
_delete_with_metric,
|
|
824
877
|
str(uuid.uuid4()),
|
|
825
878
|
kwargs={
|
|
826
|
-
"entities":
|
|
879
|
+
"entities": source_batch.to_dicts(),
|
|
827
880
|
"entity_type": entity_type,
|
|
828
881
|
"keyspace": target_keyspace,
|
|
829
882
|
"table_name": table_name,
|
|
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
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/dataclass/dataclass_abstract.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation_abstract.py
RENAMED
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation_polars.py
RENAMED
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/dataclass_validation/validation/validation_utils.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
|
|
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
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/hashicorp_vault_client.py
RENAMED
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/security/clients/hashicorp_vault/kubernetes_client.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
|
|
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
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/distributed_object_store/v3/aws_keyspaces/README.md
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
|
|
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
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/arrow_filter_expression.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/iceberg_filter_expression.py
RENAMED
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/models/expression_dsl/trino_filter_expression.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/parameters/_read_parameters.py
RENAMED
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/query_enabled_store/parameters/_write_parameters.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{adapta-5.2.2 → adapta-5.2.3}/src/adapta/storage/secrets/hashicorp_vault_secret_storage_client.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
|