From 21041891191eb7c331401a5ace0c1d35e0408112 Mon Sep 17 00:00:00 2001 From: svc-excavator-bot Date: Mon, 4 May 2026 15:14:24 +0000 Subject: [PATCH] Excavator: Upgrade API Version --- README.md | 6 ++++ docs-snippets-npm/package.json | 2 +- docs-snippets-npm/src/index.ts | 2 +- docs/v2/Filesystem/models/TrashStatus.md | 6 +++- docs/v2/Ontologies/CipherTextProperty.md | 2 +- docs/v2/SqlQueries/SqlQuery.md | 11 ++++++-- .../models/ExecuteSqlQueryRequest.md | 1 + .../SqlQueries/models/SerializationFormat.md | 12 ++++++++ foundry_sdk/_version.py | 2 +- foundry_sdk/v1/ontologies/errors.py | 28 +++++++++++++++++++ foundry_sdk/v2/cli.py | 13 +++++++-- foundry_sdk/v2/filesystem/models.py | 7 ++++- foundry_sdk/v2/language_models/__init__.py | 2 ++ foundry_sdk/v2/language_models/utils.py | 22 +++++++++++++++ foundry_sdk/v2/ontologies/errors.py | 28 +++++++++++++++++++ foundry_sdk/v2/sql_queries/errors.py | 14 ++++++++++ foundry_sdk/v2/sql_queries/models.py | 8 ++++++ foundry_sdk/v2/sql_queries/sql_query.py | 20 ++++++++++--- tests/language_models/test_utils.py | 21 ++++++++++++++ 19 files changed, 192 insertions(+), 15 deletions(-) create mode 100644 docs/v2/SqlQueries/models/SerializationFormat.md diff --git a/README.md b/README.md index fe17c9a4d..d04865f85 100644 --- a/README.md +++ b/README.md @@ -2960,6 +2960,7 @@ Namespace | Name | Import | **SqlQueries** | [ParameterValue](docs/v2/SqlQueries/models/ParameterValue.md) | `from foundry_sdk.v2.sql_queries.models import ParameterValue` | **SqlQueries** | [QueryStatus](docs/v2/SqlQueries/models/QueryStatus.md) | `from foundry_sdk.v2.sql_queries.models import QueryStatus` | **SqlQueries** | [RunningQueryStatus](docs/v2/SqlQueries/models/RunningQueryStatus.md) | `from foundry_sdk.v2.sql_queries.models import RunningQueryStatus` | +**SqlQueries** | [SerializationFormat](docs/v2/SqlQueries/models/SerializationFormat.md) | `from foundry_sdk.v2.sql_queries.models import SerializationFormat` | **SqlQueries** | [SqlQueryId](docs/v2/SqlQueries/models/SqlQueryId.md) | `from foundry_sdk.v2.sql_queries.models import SqlQueryId` | **SqlQueries** | [StructColumnFieldType](docs/v2/SqlQueries/models/StructColumnFieldType.md) | `from foundry_sdk.v2.sql_queries.models import StructColumnFieldType` | **SqlQueries** | [StructColumnType](docs/v2/SqlQueries/models/StructColumnType.md) | `from foundry_sdk.v2.sql_queries.models import StructColumnType` | @@ -3738,6 +3739,7 @@ Namespace | Name | Import | **Models** | UnsupportedModelSource | `from foundry_sdk.v2.models.errors import UnsupportedModelSource` | **Ontologies** | ActionContainsDuplicateEdits | `from foundry_sdk.v2.ontologies.errors import ActionContainsDuplicateEdits` | **Ontologies** | ActionEditedPropertiesNotFound | `from foundry_sdk.v2.ontologies.errors import ActionEditedPropertiesNotFound` | +**Ontologies** | ActionEditsNotSupportedWithMarketplace | `from foundry_sdk.v2.ontologies.errors import ActionEditsNotSupportedWithMarketplace` | **Ontologies** | ActionEditsReadOnlyEntity | `from foundry_sdk.v2.ontologies.errors import ActionEditsReadOnlyEntity` | **Ontologies** | ActionNotFound | `from foundry_sdk.v2.ontologies.errors import ActionNotFound` | **Ontologies** | ActionParameterInterfaceTypeNotFound | `from foundry_sdk.v2.ontologies.errors import ActionParameterInterfaceTypeNotFound` | @@ -3754,6 +3756,7 @@ Namespace | Name | Import | **Ontologies** | AttachmentNotFound | `from foundry_sdk.v2.ontologies.errors import AttachmentNotFound` | **Ontologies** | AttachmentRidAlreadyExists | `from foundry_sdk.v2.ontologies.errors import AttachmentRidAlreadyExists` | **Ontologies** | AttachmentSizeExceededLimit | `from foundry_sdk.v2.ontologies.errors import AttachmentSizeExceededLimit` | +**Ontologies** | BranchNotSupportedWithMarketplaceQuery | `from foundry_sdk.v2.ontologies.errors import BranchNotSupportedWithMarketplaceQuery` | **Ontologies** | CipherChannelNotFound | `from foundry_sdk.v2.ontologies.errors import CipherChannelNotFound` | **Ontologies** | CompositePrimaryKeyNotSupported | `from foundry_sdk.v2.ontologies.errors import CompositePrimaryKeyNotSupported` | **Ontologies** | ConsistentSnapshotError | `from foundry_sdk.v2.ontologies.errors import ConsistentSnapshotError` | @@ -3917,6 +3920,7 @@ Namespace | Name | Import | **Orchestration** | TargetNotSupported | `from foundry_sdk.v2.orchestration.errors import TargetNotSupported` | **Orchestration** | UnpauseSchedulePermissionDenied | `from foundry_sdk.v2.orchestration.errors import UnpauseSchedulePermissionDenied` | **SqlQueries** | CancelSqlQueryPermissionDenied | `from foundry_sdk.v2.sql_queries.errors import CancelSqlQueryPermissionDenied` | +**SqlQueries** | ColumnTypesNotSupported | `from foundry_sdk.v2.sql_queries.errors import ColumnTypesNotSupported` | **SqlQueries** | ExecuteOntologySqlQueryPermissionDenied | `from foundry_sdk.v2.sql_queries.errors import ExecuteOntologySqlQueryPermissionDenied` | **SqlQueries** | ExecuteSqlQueryPermissionDenied | `from foundry_sdk.v2.sql_queries.errors import ExecuteSqlQueryPermissionDenied` | **SqlQueries** | GetResultsSqlQueryPermissionDenied | `from foundry_sdk.v2.sql_queries.errors import GetResultsSqlQueryPermissionDenied` | @@ -4057,6 +4061,7 @@ Namespace | Name | Import | **Datasets** | UploadFilePermissionDenied | `from foundry_sdk.v1.datasets.errors import UploadFilePermissionDenied` | **Ontologies** | ActionContainsDuplicateEdits | `from foundry_sdk.v1.ontologies.errors import ActionContainsDuplicateEdits` | **Ontologies** | ActionEditedPropertiesNotFound | `from foundry_sdk.v1.ontologies.errors import ActionEditedPropertiesNotFound` | +**Ontologies** | ActionEditsNotSupportedWithMarketplace | `from foundry_sdk.v1.ontologies.errors import ActionEditsNotSupportedWithMarketplace` | **Ontologies** | ActionEditsReadOnlyEntity | `from foundry_sdk.v1.ontologies.errors import ActionEditsReadOnlyEntity` | **Ontologies** | ActionNotFound | `from foundry_sdk.v1.ontologies.errors import ActionNotFound` | **Ontologies** | ActionParameterInterfaceTypeNotFound | `from foundry_sdk.v1.ontologies.errors import ActionParameterInterfaceTypeNotFound` | @@ -4073,6 +4078,7 @@ Namespace | Name | Import | **Ontologies** | AttachmentNotFound | `from foundry_sdk.v1.ontologies.errors import AttachmentNotFound` | **Ontologies** | AttachmentRidAlreadyExists | `from foundry_sdk.v1.ontologies.errors import AttachmentRidAlreadyExists` | **Ontologies** | AttachmentSizeExceededLimit | `from foundry_sdk.v1.ontologies.errors import AttachmentSizeExceededLimit` | +**Ontologies** | BranchNotSupportedWithMarketplaceQuery | `from foundry_sdk.v1.ontologies.errors import BranchNotSupportedWithMarketplaceQuery` | **Ontologies** | CipherChannelNotFound | `from foundry_sdk.v1.ontologies.errors import CipherChannelNotFound` | **Ontologies** | CompositePrimaryKeyNotSupported | `from foundry_sdk.v1.ontologies.errors import CompositePrimaryKeyNotSupported` | **Ontologies** | ConsistentSnapshotError | `from foundry_sdk.v1.ontologies.errors import ConsistentSnapshotError` | diff --git a/docs-snippets-npm/package.json b/docs-snippets-npm/package.json index 88f01fe97..24da474bc 100644 --- a/docs-snippets-npm/package.json +++ b/docs-snippets-npm/package.json @@ -24,7 +24,7 @@ "sls": { "dependencies": { "com.palantir.foundry.api:api-gateway": { - "minVersion": "1.1590.0", + "minVersion": "1.1598.0", "maxVersion": "1.x.x", "optional": false } diff --git a/docs-snippets-npm/src/index.ts b/docs-snippets-npm/src/index.ts index e109a3d86..9fc02c32a 100644 --- a/docs-snippets-npm/src/index.ts +++ b/docs-snippets-npm/src/index.ts @@ -1875,7 +1875,7 @@ export const PYTHON_PLATFORM_SNIPPETS: SdkSnippets str: return f"https://{hostname}/api/v2/llm/proxy/anthropic" +def get_google_base_url(*, preview: bool = False) -> str: + """Get the Google proxy base URL for use with the google-genai SDK. + + Args: + preview: Must be set to True to use this beta feature. + + Returns: + The Google proxy base URL for the current Foundry environment. + + Raises: + ValueError: If preview is not set to True. + RuntimeError: If the Foundry API gateway base URL is not available in the current context. + """ + if not preview: + raise ValueError( + "get_google_base_url() is in beta. " + "Please set the preview parameter to True to use it." + ) + hostname = _get_api_gateway_base_url(preview=True) + return f"https://{hostname}/api/v2/llm/proxy/google" + + def get_http_client(*, preview: bool = False, config: Optional[Config] = None) -> HttpClient: """Get an HTTP client configured for the current Foundry environment. diff --git a/foundry_sdk/v2/ontologies/errors.py b/foundry_sdk/v2/ontologies/errors.py index 0098f84bc..c5daa0333 100644 --- a/foundry_sdk/v2/ontologies/errors.py +++ b/foundry_sdk/v2/ontologies/errors.py @@ -52,6 +52,19 @@ class ActionEditedPropertiesNotFound(errors.BadRequestError): error_instance_id: str +class ActionEditsNotSupportedWithMarketplaceParameters(typing_extensions.TypedDict): + """Returning action edits is not supported when using marketplace bindings.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + +@dataclass +class ActionEditsNotSupportedWithMarketplace(errors.BadRequestError): + name: typing.Literal["ActionEditsNotSupportedWithMarketplace"] + parameters: ActionEditsNotSupportedWithMarketplaceParameters + error_instance_id: str + + class ActionEditsReadOnlyEntityParameters(typing_extensions.TypedDict): """The given action request performs edits on a type that is read-only or does not allow edits.""" @@ -326,6 +339,19 @@ class AttachmentSizeExceededLimit(errors.BadRequestError): error_instance_id: str +class BranchNotSupportedWithMarketplaceQueryParameters(typing_extensions.TypedDict): + """The branch parameter is not supported when executing queries with marketplace bindings.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + +@dataclass +class BranchNotSupportedWithMarketplaceQuery(errors.BadRequestError): + name: typing.Literal["BranchNotSupportedWithMarketplaceQuery"] + parameters: BranchNotSupportedWithMarketplaceQueryParameters + error_instance_id: str + + class CipherChannelNotFoundParameters(typing_extensions.TypedDict): """ The Cipher Channel was not found. @@ -2448,6 +2474,7 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): __all__ = [ "ActionContainsDuplicateEdits", "ActionEditedPropertiesNotFound", + "ActionEditsNotSupportedWithMarketplace", "ActionEditsReadOnlyEntity", "ActionNotFound", "ActionParameterInterfaceTypeNotFound", @@ -2464,6 +2491,7 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "AttachmentNotFound", "AttachmentRidAlreadyExists", "AttachmentSizeExceededLimit", + "BranchNotSupportedWithMarketplaceQuery", "CipherChannelNotFound", "CompositePrimaryKeyNotSupported", "ConsistentSnapshotError", diff --git a/foundry_sdk/v2/sql_queries/errors.py b/foundry_sdk/v2/sql_queries/errors.py index c0c58033f..b3d971404 100644 --- a/foundry_sdk/v2/sql_queries/errors.py +++ b/foundry_sdk/v2/sql_queries/errors.py @@ -35,6 +35,19 @@ class CancelSqlQueryPermissionDenied(errors.PermissionDeniedError): error_instance_id: str +class ColumnTypesNotSupportedParameters(typing_extensions.TypedDict): + """The query result contains column types that are not supported by the requested serialization format.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + +@dataclass +class ColumnTypesNotSupported(errors.BadRequestError): + name: typing.Literal["ColumnTypesNotSupported"] + parameters: ColumnTypesNotSupportedParameters + error_instance_id: str + + class ExecuteOntologySqlQueryPermissionDeniedParameters(typing_extensions.TypedDict): """Could not executeOntology the SqlQuery.""" @@ -189,6 +202,7 @@ class ReadQueryInputsPermissionDenied(errors.PermissionDeniedError): __all__ = [ "CancelSqlQueryPermissionDenied", + "ColumnTypesNotSupported", "ExecuteOntologySqlQueryPermissionDenied", "ExecuteSqlQueryPermissionDenied", "GetResultsSqlQueryPermissionDenied", diff --git a/foundry_sdk/v2/sql_queries/models.py b/foundry_sdk/v2/sql_queries/models.py index 2ff3b34a4..443f0e7ee 100644 --- a/foundry_sdk/v2/sql_queries/models.py +++ b/foundry_sdk/v2/sql_queries/models.py @@ -108,6 +108,9 @@ class ExecuteSqlQueryRequest(core.ModelBase): `master` for most enrollments. """ + serialization_format: typing.Optional[SerializationFormat] = pydantic.Field(alias=str("serializationFormat"), default=None) # type: ignore[literal-required] + """The format used to serialize query results. If not specified, defaults to `ARROW`.""" + class FailedQueryStatus(core.ModelBase): """FailedQueryStatus""" @@ -306,6 +309,10 @@ class RunningQueryStatus(core.ModelBase): type: typing.Literal["running"] = "running" +SerializationFormat = typing.Literal["ARROW", "CSV"] +"""Format for SQL query result serialization.""" + + SqlQueryId = str """The identifier of a SQL Query.""" @@ -405,6 +412,7 @@ class UnnamedParameterValues(core.ModelBase): "Parameters", "QueryStatus", "RunningQueryStatus", + "SerializationFormat", "SqlQueryId", "StructColumnFieldType", "StructColumnType", diff --git a/foundry_sdk/v2/sql_queries/sql_query.py b/foundry_sdk/v2/sql_queries/sql_query.py index 1bd5480da..a8ad92df2 100644 --- a/foundry_sdk/v2/sql_queries/sql_query.py +++ b/foundry_sdk/v2/sql_queries/sql_query.py @@ -116,6 +116,7 @@ def execute( *, query: str, fallback_branch_ids: typing.Optional[typing.List[core_models.BranchName]] = None, + serialization_format: typing.Optional[sql_queries_models.SerializationFormat] = None, request_timeout: typing.Optional[core.Timeout] = None, _sdk_internal: core.SdkInternal = {}, ) -> sql_queries_models.QueryStatus: @@ -128,11 +129,14 @@ def execute( :type query: str :param fallback_branch_ids: The list of branch ids to use as fallbacks if the query fails to execute on the primary branch. If a is not explicitly provided in the SQL query, the resource will be queried on the first fallback branch provided that exists. If no fallback branches are provided the default branch is used. This is `master` for most enrollments. :type fallback_branch_ids: Optional[List[BranchName]] + :param serialization_format: The format used to serialize query results. If not specified, defaults to `ARROW`. + :type serialization_format: Optional[SerializationFormat] :param request_timeout: timeout setting for this request in seconds. :type request_timeout: Optional[int] :return: Returns the result object. :rtype: sql_queries_models.QueryStatus + :raises ColumnTypesNotSupported: The query result contains column types that are not supported by the requested serialization format. :raises ExecuteSqlQueryPermissionDenied: Could not execute the SqlQuery. :raises QueryCanceled: The query was canceled. :raises QueryFailed: The query failed. @@ -155,10 +159,12 @@ def execute( body=sql_queries_models.ExecuteSqlQueryRequest( query=query, fallback_branch_ids=fallback_branch_ids, + serialization_format=serialization_format, ), response_type=sql_queries_models.QueryStatus, request_timeout=request_timeout, throwable_errors={ + "ColumnTypesNotSupported": sql_queries_errors.ColumnTypesNotSupported, "ExecuteSqlQueryPermissionDenied": sql_queries_errors.ExecuteSqlQueryPermissionDenied, "QueryCanceled": sql_queries_errors.QueryCanceled, "QueryFailed": sql_queries_errors.QueryFailed, @@ -249,8 +255,8 @@ def get_results( _sdk_internal: core.SdkInternal = {}, ) -> core.TableResponse: """ - Gets the results of a query. The results of the query are returned in the - [Apache Arrow](https://arrow.apache.org/) format. + Gets the results of a query. Results are returned in the `serializationFormat` specified at execute time + (defaulting to [Apache Arrow](https://arrow.apache.org/) if no format is provided). This endpoint implements long polling and requests will time out after one minute. They can be safely retried while the query is still running. @@ -477,6 +483,7 @@ def execute( *, query: str, fallback_branch_ids: typing.Optional[typing.List[core_models.BranchName]] = None, + serialization_format: typing.Optional[sql_queries_models.SerializationFormat] = None, request_timeout: typing.Optional[core.Timeout] = None, _sdk_internal: core.SdkInternal = {}, ) -> typing.Awaitable[sql_queries_models.QueryStatus]: @@ -489,11 +496,14 @@ def execute( :type query: str :param fallback_branch_ids: The list of branch ids to use as fallbacks if the query fails to execute on the primary branch. If a is not explicitly provided in the SQL query, the resource will be queried on the first fallback branch provided that exists. If no fallback branches are provided the default branch is used. This is `master` for most enrollments. :type fallback_branch_ids: Optional[List[BranchName]] + :param serialization_format: The format used to serialize query results. If not specified, defaults to `ARROW`. + :type serialization_format: Optional[SerializationFormat] :param request_timeout: timeout setting for this request in seconds. :type request_timeout: Optional[int] :return: Returns the result object. :rtype: typing.Awaitable[sql_queries_models.QueryStatus] + :raises ColumnTypesNotSupported: The query result contains column types that are not supported by the requested serialization format. :raises ExecuteSqlQueryPermissionDenied: Could not execute the SqlQuery. :raises QueryCanceled: The query was canceled. :raises QueryFailed: The query failed. @@ -516,10 +526,12 @@ def execute( body=sql_queries_models.ExecuteSqlQueryRequest( query=query, fallback_branch_ids=fallback_branch_ids, + serialization_format=serialization_format, ), response_type=sql_queries_models.QueryStatus, request_timeout=request_timeout, throwable_errors={ + "ColumnTypesNotSupported": sql_queries_errors.ColumnTypesNotSupported, "ExecuteSqlQueryPermissionDenied": sql_queries_errors.ExecuteSqlQueryPermissionDenied, "QueryCanceled": sql_queries_errors.QueryCanceled, "QueryFailed": sql_queries_errors.QueryFailed, @@ -610,8 +622,8 @@ def get_results( _sdk_internal: core.SdkInternal = {}, ) -> typing.Awaitable[core.TableResponse]: """ - Gets the results of a query. The results of the query are returned in the - [Apache Arrow](https://arrow.apache.org/) format. + Gets the results of a query. Results are returned in the `serializationFormat` specified at execute time + (defaulting to [Apache Arrow](https://arrow.apache.org/) if no format is provided). This endpoint implements long polling and requests will time out after one minute. They can be safely retried while the query is still running. diff --git a/tests/language_models/test_utils.py b/tests/language_models/test_utils.py index c6accb11f..851933042 100644 --- a/tests/language_models/test_utils.py +++ b/tests/language_models/test_utils.py @@ -22,6 +22,7 @@ from foundry_sdk.v2.language_models import get_anthropic_base_url from foundry_sdk.v2.language_models import get_async_http_client from foundry_sdk.v2.language_models import get_foundry_token +from foundry_sdk.v2.language_models import get_google_base_url from foundry_sdk.v2.language_models import get_http_client from foundry_sdk.v2.language_models import get_openai_base_url from foundry_sdk.v2.language_models.utils import _get_api_gateway_base_url @@ -46,6 +47,10 @@ def test_get_anthropic_base_url_requires_preview(self): with pytest.raises(ValueError, match="preview parameter"): get_anthropic_base_url() + def test_get_google_base_url_requires_preview(self): + with pytest.raises(ValueError, match="preview parameter"): + get_google_base_url() + def test_get_http_client_requires_preview(self): with pytest.raises(ValueError, match="preview parameter"): get_http_client() @@ -115,6 +120,22 @@ def test_raises_runtime_error_when_not_in_context(self): get_anthropic_base_url(preview=True) +class TestGetGoogleBaseUrl: + """Test get_google_base_url function.""" + + def test_returns_correct_url(self): + token = HOSTNAME_VAR.set("test.palantirfoundry.com") + try: + result = get_google_base_url(preview=True) + assert result == "https://test.palantirfoundry.com/api/v2/llm/proxy/google" + finally: + HOSTNAME_VAR.reset(token) + + def test_raises_runtime_error_when_not_in_context(self): + with pytest.raises(RuntimeError, match="not available"): + get_google_base_url(preview=True) + + class TestGetHttpClient: """Test get_http_client function."""