This was requested in Discord
Is there any chance to name the iceberg catalogs with underscores? Because underscores are forbidden in K8S resource names, but when using the dash sign for naming you‘ll have to use paranthesis like „iceberg-prod“.schema.table for referencing
As I was running into the exact same situation with a customer a day before I figured let's quickly address this.
Background info:
- Valid TrinoCatalog name characters are
a-z and -.
- Most people want to replace the
- with _, so in SQL you can use select * from my_catalog.my_schema.my_table instead of select * from "my-catalog"."my-schema"."my-table"
I'm proposing two small new features:
- Add override mechanism for maximum flexibility.
- As 1. is error-prone (we need to raise an error in case the same catalog name is used in different TrinoCatalogs) and requires duplication in the TrinoCatalog, we offer a helper to replace
- with _. As it it would be a breaking change, we sadly need to make it opt-in.
Both options are super easy to implement. They give easy replacement as well as maximum flexibility to the user.
I quickly spiked this and ended up with the following CRD change
# Top level properties on TrinoCatalog
catalogNameOverride:
description: |-
Override the name of the catalog as it shows up in Trino.
By default, the Trino catalog is named the same as the `.metadata.name` of the
TrinoCatalog resource. It is your responsibility to make sure that no catalog names
clash, the operator will raise an error in that case.
TIP: If you only want to replace `-` with `_` use `catalogNameReplaceHyphens` instead.
nullable: true
type: string
catalogNameReplaceHyphens:
default: false
description: |-
Wether hyphens (`-`) in the name of the catalog should be replaced by underscores (`_`).
This is recommended because Kubernetes only allows `a-z` and `-`, while Trino
requires quoting for catalogs containing `-` characters, but not for `_`. This mechanism
allows you to use valid Kubernetes names, but keeps the convenience of `_` in catalog
names.
In case you need complete flexibility over the catalog name, you can use
`catalogNameOverride`.
type: boolean
This was requested in Discord
As I was running into the exact same situation with a customer a day before I figured let's quickly address this.
Background info:
a-zand-.-with_, so in SQL you can useselect * from my_catalog.my_schema.my_tableinstead ofselect * from "my-catalog"."my-schema"."my-table"I'm proposing two small new features:
-with_. As it it would be a breaking change, we sadly need to make it opt-in.Both options are super easy to implement. They give easy replacement as well as maximum flexibility to the user.
I quickly spiked this and ended up with the following CRD change