Naming Utilities¶
geoembed.core.naming
¶
Unity Catalog naming utilities.
Databricks Unity Catalog has two addressing modes:
- Delta tables (SQL identifiers): catalog.schema.table
- Identifiers with special characters (hyphens, etc.) MUST be backtick-quoted
- Example:
catalog-foo.schema.table - Used in: saveAsTable(), read.table(), spark.sql("SELECT ... FROM ...")
-
MUST be three-part: catalog.schema.table
-
Volumes (file paths): /Volumes/catalog/schema/volume/path/file.tif
- These are filesystem paths — NO backticks, no quoting
- Used in: spark.read.load(), rasterio.open(), os.path operations
This module provides quote_table_name() to handle case 1.
Volume paths (case 2) should be used as-is — never quote them.
quote_table_name(table_name)
¶
Backtick-quote a Unity Catalog table name for use in Spark SQL operations.
Handles identifiers containing hyphens or other special characters by wrapping each dot-separated part in backticks.
Only use this for Delta table references (saveAsTable, read.table, SQL statements). Do NOT use for Volume file paths (/Volumes/...) — those are filesystem paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name
|
str
|
Three-part dot-separated table name: "catalog.schema.table". Two-part names (schema.table) are also accepted but will use the session's default catalog. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Backtick-quoted name (e.g., " |
Raises:
| Type | Description |
|---|---|
ValueError
|
If table_name has fewer than 2 parts or more than 3 parts. |
Examples:
>>> quote_table_name("catalog-with-hyphens.data.embeddings")
'`catalog-with-hyphens`.`data`.`embeddings`'