-
Notifications
You must be signed in to change notification settings - Fork 4
SQL: Auto union Iceberg and Redpanda topic #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kbatuigas
wants to merge
12
commits into
rp-sql
Choose a base branch
from
DOC-2006-document-feature-auto-union-iceberg-and-redpanda-topic
base: rp-sql
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e06ea19
Start reference update for SQL / Iceberg catalog
kbatuigas 57157d0
Draft bridge queries doc
kbatuigas 7b410a5
Update query-iceberg-topics per SME feedback
kbatuigas 7e6f4e6
Add new iceberg catalog statements
kbatuigas 41cc35c
Clarify Iceberg benefit of querying data aged out of topic retention
kbatuigas 4c29076
Links to Iceberg catalog docs
kbatuigas 15a37f3
Update example names
kbatuigas 3e917bb
Update based on new-features list
kbatuigas 29cc2c3
Sync options from source
kbatuigas 6406d13
Apply suggestions from SME feedback
kbatuigas 14831ec
Apply suggestions
kbatuigas 6999a6c
Note about default schema
kbatuigas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
modules/reference/pages/sql/sql-statements/alter-iceberg-catalog.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| = ALTER ICEBERG CATALOG | ||
| :description: The ALTER ICEBERG CATALOG statement modifies connection properties of an existing Iceberg catalog. | ||
| :page-topic-type: reference | ||
|
|
||
| The `ALTER ICEBERG CATALOG` statement modifies connection properties of an existing Iceberg catalog. You must repeat the `STORAGE` clause when altering, even if the storage connection is not changing. | ||
|
|
||
| == Syntax | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| ALTER ICEBERG CATALOG [IF EXISTS] catalog_name STORAGE storage_name | ||
| WITH (option = 'value' [, ...]); | ||
| ---- | ||
|
|
||
| * `catalog_name`: Name of the Iceberg catalog to modify. | ||
| * `IF EXISTS`: Optional. Prevents an error if the Iceberg catalog does not exist. | ||
| * `storage_name`: Name of the storage connection backing the catalog. | ||
| * `option = 'value'`: One or more connection options to update. See xref:reference:sql/sql-statements/create-iceberg-catalog.adoc[CREATE ICEBERG CATALOG] for the full list of options. | ||
|
|
||
| == Examples | ||
|
|
||
| Update the REST catalog URI for an existing Iceberg catalog: | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| ALTER ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH (uri = 'https://new-catalog.example.com'); | ||
| ---- | ||
|
|
||
| Rotate the basic-authentication credentials on an existing Iceberg catalog: | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| ALTER ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH ( | ||
| auth_type = 'basic', | ||
| username = '<new-username>', | ||
| password = '<new-password>' | ||
| ); | ||
| ---- |
210 changes: 210 additions & 0 deletions
210
modules/reference/pages/sql/sql-statements/create-iceberg-catalog.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| = CREATE ICEBERG CATALOG | ||
| :description: The CREATE ICEBERG CATALOG statement creates a named connection to an Iceberg REST catalog, enabling Redpanda SQL to query Iceberg-translated topic data. | ||
| :page-topic-type: reference | ||
|
|
||
| The `CREATE ICEBERG CATALOG` statement creates a named connection to an Iceberg REST catalog. Link the Iceberg catalog to a Redpanda catalog with `USING CATALOG` so that queries against the linked Redpanda catalog return both live and Iceberg-translated records. Standalone querying against an Iceberg catalog is not supported. See xref:sql:query-data/query-iceberg-topics.adoc[Query Iceberg topics] for the end-to-end workflow. | ||
|
|
||
| The statement requires an existing xref:reference:sql/sql-statements/create-storage.adoc[storage connection] that holds the object-storage credentials for the Iceberg warehouse. | ||
|
|
||
| == Syntax | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| CREATE ICEBERG CATALOG [IF NOT EXISTS] catalog_name STORAGE storage_name | ||
| WITH (option = 'value' [, ...]); | ||
| ---- | ||
|
|
||
| * `catalog_name`: Name for the new Iceberg catalog. | ||
| * `IF NOT EXISTS`: Optional. Prevents an error if an Iceberg catalog with the same name already exists. | ||
| * `storage_name`: Name of an existing storage connection. Create it first with xref:reference:sql/sql-statements/create-storage.adoc[CREATE STORAGE]. | ||
|
|
||
| NOTE: Catalogs are created in the current schema (`public` by default). To create a catalog in a different schema, qualify the name as `schema.catalog_name`. The auto-created `default_iceberg_catalog` is in `public`. | ||
|
|
||
| == Options | ||
|
|
||
| [cols="<30%,<15%,<10%,<45%",options="header"] | ||
| |=== | ||
| |Option |Type |Required |Description | ||
|
|
||
| |`uri` | ||
| |STRING | ||
| |Yes | ||
| |REST catalog endpoint URI. | ||
|
|
||
| |`warehouse` | ||
| |STRING | ||
| |No | ||
| |Iceberg warehouse identifier or location. | ||
|
|
||
| |`auth_type` | ||
| |STRING | ||
| |No | ||
| |Authentication type for the REST catalog. One of `oauth2`, `basic`, or `aws_sigv4`. If omitted, the catalog connects without authentication. Providing an auth-specific option (such as `username` or `aws_region`) without `auth_type` is rejected. | ||
|
|
||
| |`oauth2_client_id` | ||
| |STRING | ||
| |Required when `auth_type = 'oauth2'` | ||
| |OAuth2 client ID. | ||
|
|
||
| |`oauth2_client_secret` | ||
| |STRING | ||
| |Required when `auth_type = 'oauth2'` | ||
| |OAuth2 client secret. | ||
|
|
||
| |`oauth2_scope` | ||
| |STRING | ||
| |No | ||
| |OAuth2 scope to request. | ||
|
|
||
| |`oauth2_token_endpoint_url` | ||
| |STRING | ||
| |No | ||
| |OAuth2 token endpoint URL. Use to override the catalog's default token endpoint. | ||
|
|
||
| |`oauth2_token_refresh_margin_seconds` | ||
| |INTEGER | ||
| |No | ||
| |Number of seconds before token expiry to refresh. Must be between 0 and 2147483647. | ||
|
|
||
| |`username` | ||
| |STRING | ||
| |Required when `auth_type = 'basic'` | ||
| |Basic authentication username. | ||
|
|
||
| |`password` | ||
| |STRING | ||
| |Required when `auth_type = 'basic'` | ||
| |Basic authentication password. | ||
|
|
||
| |`aws_region` | ||
| |STRING | ||
| |Required when `auth_type = 'aws_sigv4'` | ||
| |AWS region for SigV4 request signing (for example, `us-west-2`). | ||
|
|
||
| |`aws_access_key_id` | ||
| |STRING | ||
| |No | ||
| |AWS access key ID for SigV4 signing. Must be set together with `aws_secret_access_key`. If both are omitted, the catalog uses the AWS default credential chain (environment variables, shared config, STS web identity, IMDSv2/ECS). | ||
|
|
||
| |`aws_secret_access_key` | ||
| |STRING | ||
| |No | ||
| |AWS secret access key for SigV4 signing. See `aws_access_key_id` for credential-chain behavior. | ||
|
|
||
| |`ssl_verify` | ||
| |STRING | ||
| |No | ||
| |`'true'` (default) or `'false'`. Whether to verify the REST catalog's TLS certificate. | ||
|
|
||
| |`ssl_ca_info` | ||
| |STRING | ||
| |No | ||
| |Path to a CA certificate file used to verify the REST catalog's TLS certificate. | ||
|
|
||
| |`ssl_ca_path` | ||
| |STRING | ||
| |No | ||
| |Path to a directory containing CA certificates. | ||
|
|
||
| |`ssl_crl_file` | ||
| |STRING | ||
| |No | ||
| |Path to a certificate revocation list (CRL) file. | ||
| |=== | ||
|
|
||
| == Examples | ||
|
|
||
| === Create a basic Iceberg catalog | ||
|
|
||
| Connect to a REST catalog without authentication. The catalog uses TLS verification by default. | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| CREATE ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH ( | ||
| uri = 'https://catalog.example.com', | ||
| warehouse = 's3://warehouse/' | ||
| ); | ||
| ---- | ||
|
|
||
| === Create an Iceberg catalog with OAuth2 authentication | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| CREATE ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH ( | ||
| uri = 'https://catalog.example.com', | ||
| warehouse = 's3://lakehouse-data/', | ||
| auth_type = 'oauth2', | ||
| oauth2_client_id = '<client-id>', | ||
| oauth2_client_secret = '<client-secret>', | ||
| oauth2_scope = 'PRINCIPAL_ROLE:ALL', | ||
| oauth2_token_endpoint_url = 'https://auth.example.com/token', | ||
| oauth2_token_refresh_margin_seconds = 300 | ||
| ); | ||
| ---- | ||
|
|
||
| === Create an Iceberg catalog with basic authentication | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| CREATE ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH ( | ||
| uri = 'https://catalog.example.com', | ||
| warehouse = 's3://warehouse/', | ||
| auth_type = 'basic', | ||
| username = '<username>', | ||
| password = '<password>' | ||
| ); | ||
| ---- | ||
|
|
||
| === Create an Iceberg catalog with AWS SigV4 authentication | ||
|
|
||
| Use for REST catalogs fronted by AWS services (such as AWS Glue). | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| CREATE ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH ( | ||
| uri = 'https://catalog.example.com', | ||
| warehouse = 's3://warehouse/', | ||
| auth_type = 'aws_sigv4', | ||
| aws_region = 'us-west-2', | ||
| aws_access_key_id = '<access-key-id>', | ||
| aws_secret_access_key = '<secret-access-key>' | ||
| ); | ||
| ---- | ||
|
|
||
| To use the AWS default credential chain (for example, an EC2 instance-profile role), omit `aws_access_key_id` and `aws_secret_access_key`. They must be set together or omitted together. | ||
|
|
||
| === Create an Iceberg catalog with custom TLS settings | ||
|
|
||
| [source,sql] | ||
| ---- | ||
| CREATE ICEBERG CATALOG lakehouse_catalog STORAGE iceberg_storage | ||
| WITH ( | ||
| uri = 'https://catalog.example.com', | ||
| warehouse = 's3://warehouse/', | ||
| ssl_verify = 'true', | ||
| ssl_ca_info = '/etc/ssl/certs/catalog-ca.pem' | ||
| ); | ||
| ---- | ||
|
|
||
| == Related statements | ||
|
|
||
| [cols="<40%,<60%",options="header"] | ||
| |=== | ||
| |Statement |Description | ||
|
|
||
| |xref:reference:sql/sql-statements/alter-iceberg-catalog.adoc[ALTER ICEBERG CATALOG] | ||
| |Modify connection properties of an existing Iceberg catalog. | ||
|
|
||
| |xref:reference:sql/sql-statements/drop-iceberg-catalog.adoc[DROP ICEBERG CATALOG] | ||
| |Remove an Iceberg catalog. | ||
|
|
||
| |xref:reference:sql/sql-statements/create-storage.adoc[CREATE STORAGE] | ||
| |Create the storage connection that backs the Iceberg catalog. | ||
|
|
||
| |xref:reference:sql/sql-statements/create-redpanda-catalog.adoc[CREATE REDPANDA CATALOG] | ||
| |Create a Redpanda catalog. Use `USING CATALOG` to link a Redpanda catalog to an Iceberg catalog so that queries return both live and Iceberg-translated records. | ||
| |=== | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we tell users to create and reference secrets here in the same way we do for RP Cloud secrets such as for catalog credentials in the cluster config, like so? https://deploy-preview-575--rp-cloud.netlify.app/redpanda-cloud/manage/iceberg/use-iceberg-catalogs/#use-a-secret-in-cluster-configuration