Skip to content

Commit c246066

Browse files
Joe Lodinhashhar
Joe Lodin
authored andcommitted
Document case-sensitive configuration properties
1 parent 9e8b34d commit c246066

File tree

11 files changed

+93
-10
lines changed

11 files changed

+93
-10
lines changed

docs/src/main/sphinx/connector/clickhouse.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ configured connector to create a catalog named ``sales``.
4848

4949
.. include:: jdbc-common-configurations.fragment
5050

51+
.. include:: jdbc-case-insensitive-matching.fragment
52+
5153
.. include:: non-transactional-insert.fragment
5254

5355
Querying ClickHouse

docs/src/main/sphinx/connector/druid.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ name from the properties file.
4444

4545
.. include:: jdbc-common-configurations.fragment
4646

47+
.. include:: jdbc-case-insensitive-matching.fragment
48+
4749
.. _druid-type-mapping:
4850

4951
Type mapping
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Case insensitive matching
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
When ``case-insensitive-name-matching`` is set to ``true``, Trino
5+
is able to query non-lowercase schemas and tables by maintaining a mapping of
6+
the lowercase name to the actual name in the remote system. However, if two
7+
schemas and/or tables have names that differ only in case (such as "customers"
8+
and "Customers") then Trino fails to query them due to ambiguity.
9+
10+
In these cases, use the ``case-insensitive-name-matching.config-file`` catalog
11+
configuration property to specify a configuration file that maps these remote
12+
schemas/tables to their respective Trino schemas/tables:
13+
14+
.. code-block:: json
15+
16+
{
17+
"schemas": [
18+
{
19+
"remote": "CaseSensitiveName",
20+
"mapping": "case_insensitive_1"
21+
},
22+
{
23+
"remote": "cASEsENSITIVEnAME",
24+
"mapping": "case_insensitive_2"
25+
}],
26+
"tables": [
27+
{
28+
"remoteSchema": "CaseSensitiveName",
29+
"remoteTable": "tablex",
30+
"mapping": "table_1"
31+
},
32+
{
33+
"remoteSchema": "CaseSensitiveName",
34+
"remoteTable": "TABLEX",
35+
"mapping": "table_2"
36+
}]
37+
}
38+
39+
Queries against one of the tables or schemes defined in the ``mapping``
40+
attributes are run against the corresponding remote entity. For example, a query
41+
against tables in the ``case_insensitive_1`` schema is forwarded to the
42+
CaseSensitiveName schema and a query against ``case_insensitive_2`` is forwarded
43+
to the ``cASEsENSITIVEnAME`` schema.
44+
45+
At the table mapping level, a query on ``case_insensitive_1.table_1`` as
46+
configured above is forwarded to ``CaseSensitiveName.tablex``, and a query on
47+
``case_insensitive_1.table_2`` is forwarded to ``CaseSensitiveName.TABLEX``.
48+
49+
By default, when a change is made to the mapping configuration file, Trino must
50+
be restarted to load the changes. Optionally, you can set the
51+
``case-insensitive-name-mapping.refresh-period`` to have Trino refresh the
52+
properties without requiring a restart:
53+
54+
.. code-block:: properties
55+
56+
case-insensitive-name-mapping.refresh-period=30s
Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
General configuration properties
22
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33

4-
The following table describes general configuration properties for the
4+
The following table describes general catalog configuration properties for the
55
connector:
66

77
.. list-table::
@@ -12,29 +12,38 @@ connector:
1212
- Description
1313
- Default value
1414
* - ``case-insensitive-name-matching``
15-
- Match schema and table names case insensitively
16-
- False
15+
- Support case insensitive schema and table names.
16+
- ``false``
1717
* - ``case-insensitive-name-matching.cache-ttl``
1818
-
19-
- 1 minute
19+
- ``1m``
20+
* - ``case-insensitive-name-matching.config-file``
21+
- Path to a name mapping configuration file in JSON format that allows
22+
Trino to disambiguate between schemas and tables with similar names in
23+
different cases.
24+
- ``null``
25+
* - ``case-insensitive-name-matching.refresh-period``
26+
- Frequency with which Trino checks the name matching configuration file
27+
for changes.
28+
- ``0`` (refresh disabled)
2029
* - ``metadata.cache-ttl``
2130
- Duration for which metadata, including table and column statistics, is
22-
cached
23-
- 0 (disabled caching)
31+
cached.
32+
- ``0`` (caching disabled)
2433
* - ``metadata.cache-missing``
2534
- Cache the fact that metadata, including table and column statistics, is
2635
not available
27-
- False
36+
- ``false``
2837
* - ``metadata.cache-maximum-size``
2938
- Maximum number of objects stored in the metadata cache
30-
- 10000
39+
- ``10000``
3140
* - ``write.batch-size``
3241
- Maximum number of statements in a batched execution.
3342
Do not change this setting from the default. Non-default values may
3443
negatively impact performance.
35-
- 1000
44+
- ``1000``
3645
* - ``join-pushdown.enabled``
3746
- Enable :ref:`join pushdown <join-pushdown>`. Equivalent :doc:`catalog
3847
session property </sql/set-session>` is ``join_pushdown_enabled``. Enabling
3948
this may negatively impact performance for some queries.
40-
- False
49+
- ``false``

docs/src/main/sphinx/connector/memsql.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ will create a catalog named ``sales`` using the configured connector.
4343

4444
.. include:: jdbc-common-configurations.fragment
4545

46+
.. include:: jdbc-case-insensitive-matching.fragment
47+
4648
.. include:: non-transactional-insert.fragment
4749

4850
Querying SingleStore

docs/src/main/sphinx/connector/mysql.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ creates a catalog named ``sales`` using the configured connector.
6161

6262
.. include:: jdbc-common-configurations.fragment
6363

64+
.. include:: jdbc-case-insensitive-matching.fragment
65+
6466
.. include:: non-transactional-insert.fragment
6567

6668
.. _mysql-type-mapping:

docs/src/main/sphinx/connector/oracle.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ you name the property file ``sales.properties``, Trino creates a catalog named
7777

7878
.. include:: jdbc-common-configurations.fragment
7979

80+
.. include:: jdbc-case-insensitive-matching.fragment
81+
8082
.. include:: non-transactional-insert.fragment
8183

8284
Querying Oracle

docs/src/main/sphinx/connector/phoenix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Property Name Required Description
6060

6161
.. include:: jdbc-common-configurations.fragment
6262

63+
.. include:: jdbc-case-insensitive-matching.fragment
64+
6365
.. include:: non-transactional-insert.fragment
6466

6567
Querying Phoenix tables

docs/src/main/sphinx/connector/postgresql.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ catalog named ``sales`` using the configured connector.
6161

6262
.. include:: jdbc-common-configurations.fragment
6363

64+
.. include:: jdbc-case-insensitive-matching.fragment
65+
6466
.. include:: non-transactional-insert.fragment
6567

6668
.. _postgresql-type-mapping:

docs/src/main/sphinx/connector/redshift.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ catalog named ``sales`` using the configured connector.
4646

4747
.. include:: jdbc-common-configurations.fragment
4848

49+
.. include:: jdbc-case-insensitive-matching.fragment
50+
4951
.. include:: non-transactional-insert.fragment
5052

5153
Querying Redshift

docs/src/main/sphinx/connector/sqlserver.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ catalog named ``sales`` using the configured connector.
5959

6060
.. include:: jdbc-common-configurations.fragment
6161

62+
.. include:: jdbc-case-insensitive-matching.fragment
63+
6264
.. include:: non-transactional-insert.fragment
6365

6466
Querying SQL Server

0 commit comments

Comments
 (0)