Skip to content

Release v0.4.0#91

Merged
nfx merged 1 commit intomainfrom
prepare/0.4.0
Apr 11, 2024
Merged

Release v0.4.0#91
nfx merged 1 commit intomainfrom
prepare/0.4.0

Conversation

@nfx
Copy link
Copy Markdown
Collaborator

@nfx nfx commented Apr 11, 2024

  • Added catalog and schema parameters to execute and fetch (#90). In this release, we have added optional catalog and schema parameters to the execute and fetch methods in the SqlBackend abstract base class, allowing for more flexibility when executing SQL statements in specific catalogs and schemas. These updates include new method signatures and their respective implementations in the SparkSqlBackend and DatabricksSqlBackend classes. The new parameters control the catalog and schema used by the SparkSession instance in the SparkSqlBackend class and the SqlClient instance in the DatabricksSqlBackend class. This enhancement enables better functionality in multi-catalog and multi-schema environments. Additionally, this change comes with unit tests and integration tests to ensure proper functionality. The new parameters can be used when calling the execute and fetch methods. For example, with a SparkSqlBackend instance spark_backend, you can execute a SQL statement in a specific catalog and schema with the following code: spark_backend.execute("SELECT * FROM my_table", catalog="my_catalog", schema="my_schema"). Similarly, the fetch method can also be used with the new parameters.

* Added catalog and schema parameters to execute and fetch ([#90](#90)). In this release, we have added optional `catalog` and `schema` parameters to the `execute` and `fetch` methods in the `SqlBackend` abstract base class, allowing for more flexibility when executing SQL statements in specific catalogs and schemas. These updates include new method signatures and their respective implementations in the `SparkSqlBackend` and `DatabricksSqlBackend` classes. The new parameters control the catalog and schema used by the `SparkSession` instance in the `SparkSqlBackend` class and the `SqlClient` instance in the `DatabricksSqlBackend` class. This enhancement enables better functionality in multi-catalog and multi-schema environments. Additionally, this change comes with unit tests and integration tests to ensure proper functionality. The new parameters can be used when calling the `execute` and `fetch` methods. For example, with a `SparkSqlBackend` instance `spark_backend`, you can execute a SQL statement in a specific catalog and schema with the following code: `spark_backend.execute("SELECT * FROM my_table", catalog="my_catalog", schema="my_schema")`. Similarly, the `fetch` method can also be used with the new parameters.
@nfx nfx merged commit 8f3d164 into main Apr 11, 2024
@nfx nfx deleted the prepare/0.4.0 branch April 11, 2024 17:27
@github-actions
Copy link
Copy Markdown

❌ 19/20 passed, 1 failed, 2 skipped, 5m28s total

❌ test_overwrite: databricks.sdk.errors.platform.BadRequest: [INSUFFICIENT_PERMISSIONS] Insufficient privileges: (526ms)
databricks.sdk.errors.platform.BadRequest: [INSUFFICIENT_PERMISSIONS] Insufficient privileges:
User does not have permission CREATE,USAGE on database `TEST_SCHEMA`.
17:27 DEBUG [databricks.sdk] Loaded from environment
17:27 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
17:27 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
17:27 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
17:27 INFO [databricks.sdk] Using Databricks Metadata Service authentication
[gw5] linux -- Python 3.10.14 /home/runner/work/lsql/lsql/.venv/bin/python
17:27 DEBUG [databricks.sdk] Loaded from environment
17:27 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
17:27 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
17:27 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
17:27 INFO [databricks.sdk] Using Databricks Metadata Service authentication
17:27 DEBUG [databricks.labs.lsql.backends] [api][execute] CREATE TABLE IF NOT EXISTS hive_metastore.TEST_SCHEMA.foo (first STRING NOT NULL, second BOOLEAN NOT... (18 more bytes)
17:27 DEBUG [databricks.labs.lsql.core] Executing SQL statement: CREATE TABLE IF NOT EXISTS hive_metastore.TEST_SCHEMA.foo (first STRING NOT NULL, second BOOLEAN NOT NULL) USING DELTA
17:27 DEBUG [databricks.sdk] POST /api/2.0/sql/statements/
> {
>   "format": "JSON_ARRAY",
>   "statement": "CREATE TABLE IF NOT EXISTS hive_metastore.TEST_SCHEMA.foo (first STRING NOT NULL, second BOOLEAN NOT... (18 more bytes)",
>   "warehouse_id": "TEST_DEFAULT_WAREHOUSE_ID"
> }
< 200 OK
< {
<   "statement_id": "01eef828-b913-1c50-8882-77e69313a93d",
<   "status": {
<     "error": {
<       "error_code": "BAD_REQUEST",
<       "message": "[INSUFFICIENT_PERMISSIONS] Insufficient privileges:\nUser does not have permission CREATE,USAGE o... (21 more bytes)"
<     },
<     "state": "FAILED"
<   }
< }
17:27 DEBUG [databricks.sdk] Loaded from environment
17:27 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
17:27 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
17:27 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
17:27 INFO [databricks.sdk] Using Databricks Metadata Service authentication
17:27 DEBUG [databricks.labs.lsql.backends] [api][execute] CREATE TABLE IF NOT EXISTS hive_metastore.TEST_SCHEMA.foo (first STRING NOT NULL, second BOOLEAN NOT... (18 more bytes)
17:27 DEBUG [databricks.labs.lsql.core] Executing SQL statement: CREATE TABLE IF NOT EXISTS hive_metastore.TEST_SCHEMA.foo (first STRING NOT NULL, second BOOLEAN NOT NULL) USING DELTA
17:27 DEBUG [databricks.sdk] POST /api/2.0/sql/statements/
> {
>   "format": "JSON_ARRAY",
>   "statement": "CREATE TABLE IF NOT EXISTS hive_metastore.TEST_SCHEMA.foo (first STRING NOT NULL, second BOOLEAN NOT... (18 more bytes)",
>   "warehouse_id": "TEST_DEFAULT_WAREHOUSE_ID"
> }
< 200 OK
< {
<   "statement_id": "01eef828-b913-1c50-8882-77e69313a93d",
<   "status": {
<     "error": {
<       "error_code": "BAD_REQUEST",
<       "message": "[INSUFFICIENT_PERMISSIONS] Insufficient privileges:\nUser does not have permission CREATE,USAGE o... (21 more bytes)"
<     },
<     "state": "FAILED"
<   }
< }
[gw5] linux -- Python 3.10.14 /home/runner/work/lsql/lsql/.venv/bin/python

Running from acceptance #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant