Skip to content
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

Update docs for connector catalog examples-5 #15599

Merged
merged 1 commit into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ example, the following statement is supported:

.. code-block:: sql

ALTER TABLE catalog.schema_one.table_one RENAME TO catalog.schema_one.table_two
ALTER TABLE example.schema_one.table_one RENAME TO example.schema_one.table_two

The following statement attempts to rename a table across schemas, and therefore
is not supported:

.. code-block:: sql

ALTER TABLE catalog.schema_one.table_one RENAME TO catalog.schema_two.table_two
ALTER TABLE example.schema_one.table_one RENAME TO example.schema_two.table_two
23 changes: 11 additions & 12 deletions docs/src/main/sphinx/connector/mariadb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ To connect to MariaDB, you need:
Configuration
-------------

To configure the MariaDB connector, create a catalog properties file
in ``etc/catalog`` named, for example, ``mariadb.properties``, to
mount the MariaDB connector as the ``mariadb`` catalog.
Create the file with the following contents, replacing the
connection properties as appropriate for your setup:
To configure the MariaDB connector, create a catalog properties file in
``etc/catalog`` named, for example, ``example.properties``, to mount the MariaDB
connector as the ``example`` catalog. Create the file with the following
contents, replacing the connection properties as appropriate for your setup:

.. code-block:: text

Expand Down Expand Up @@ -56,25 +55,25 @@ Querying MariaDB
The MariaDB connector provides a schema for every MariaDB *database*.
You can see the available MariaDB databases by running ``SHOW SCHEMAS``::

SHOW SCHEMAS FROM mariadb;
SHOW SCHEMAS FROM example;

If you have a MariaDB database named ``web``, you can view the tables
in this database by running ``SHOW TABLES``::

SHOW TABLES FROM mariadb.web;
SHOW TABLES FROM example.web;

You can see a list of the columns in the ``clicks`` table in the ``web``
database using either of the following::

DESCRIBE mariadb.web.clicks;
SHOW COLUMNS FROM mariadb.web.clicks;
DESCRIBE example.web.clicks;
SHOW COLUMNS FROM example.web.clicks;

Finally, you can access the ``clicks`` table in the ``web`` database::

SELECT * FROM mariadb.web.clicks;
SELECT * FROM example.web.clicks;

If you used a different name for your catalog properties file, use
that catalog name instead of ``mariadb`` in the above examples.
that catalog name instead of ``example`` in the above examples.

.. mariadb-type-mapping:

Expand Down Expand Up @@ -298,7 +297,7 @@ As an example, select the age of employees by using ``TIMESTAMPDIFF`` and
age
FROM
TABLE(
mariadb.system.query(
example.system.query(
query => 'SELECT
TIMESTAMPDIFF(
YEAR,
Expand Down
10 changes: 5 additions & 5 deletions docs/src/main/sphinx/connector/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Configuration
-------------

To configure the Memory connector, create a catalog properties file
``etc/catalog/memory.properties`` with the following contents:
``etc/catalog/example.properties`` with the following contents:

.. code-block:: text

Expand All @@ -24,21 +24,21 @@ Examples

Create a table using the Memory connector::

CREATE TABLE memory.default.nation AS
CREATE TABLE example.default.nation AS
SELECT * from tpch.tiny.nation;

Insert data into a table in the Memory connector::

INSERT INTO memory.default.nation
INSERT INTO example.default.nation
SELECT * FROM tpch.tiny.nation;

Select from the Memory connector::

SELECT * FROM memory.default.nation;
SELECT * FROM example.default.nation;

Drop table::

DROP TABLE memory.default.nation;
DROP TABLE example.default.nation;

.. _memory-type-mapping:

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/sphinx/connector/mongodb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Configuration
-------------

To configure the MongoDB connector, create a catalog properties file
``etc/catalog/mongodb.properties`` with the following contents,
``etc/catalog/example.properties`` with the following contents,
replacing the properties as appropriate:

.. code-block:: text
Expand Down Expand Up @@ -526,7 +526,7 @@ For example, get all rows where ``regionkey`` field is 0::
*
FROM
TABLE(
mongodb.system.query(
example.system.query(
database => 'tpch',
collection => 'region',
filter => '{ regionkey: 0 }'
Expand Down
23 changes: 11 additions & 12 deletions docs/src/main/sphinx/connector/mysql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ To connect to MySQL, you need:
Configuration
-------------

To configure the MySQL connector, create a catalog properties file
in ``etc/catalog`` named, for example, ``mysql.properties``, to
mount the MySQL connector as the ``mysql`` catalog.
Create the file with the following contents, replacing the
connection properties as appropriate for your setup:
To configure the MySQL connector, create a catalog properties file in
``etc/catalog`` named, for example, ``example.properties``, to mount the MySQL
connector as the ``mysql`` catalog. Create the file with the following contents,
replacing the connection properties as appropriate for your setup:

.. code-block:: text

Expand Down Expand Up @@ -266,25 +265,25 @@ Querying MySQL
The MySQL connector provides a schema for every MySQL *database*.
You can see the available MySQL databases by running ``SHOW SCHEMAS``::

SHOW SCHEMAS FROM mysql;
SHOW SCHEMAS FROM example;

If you have a MySQL database named ``web``, you can view the tables
in this database by running ``SHOW TABLES``::

SHOW TABLES FROM mysql.web;
SHOW TABLES FROM example.web;

You can see a list of the columns in the ``clicks`` table in the ``web`` database
using either of the following::

DESCRIBE mysql.web.clicks;
SHOW COLUMNS FROM mysql.web.clicks;
DESCRIBE example.web.clicks;
SHOW COLUMNS FROM example.web.clicks;

Finally, you can access the ``clicks`` table in the ``web`` database::

SELECT * FROM mysql.web.clicks;
SELECT * FROM example.web.clicks;

If you used a different name for your catalog properties file, use
that catalog name instead of ``mysql`` in the above examples.
that catalog name instead of ``example`` in the above examples.

.. _mysql-sql-support:

Expand Down Expand Up @@ -332,7 +331,7 @@ For example, group and concatenate all employee IDs by manager ID::
*
FROM
TABLE(
mysql.system.query(
example.system.query(
query => 'SELECT
manager_id, GROUP_CONCAT(employee_id)
FROM
Expand Down
22 changes: 11 additions & 11 deletions docs/src/main/sphinx/connector/oracle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ To connect to Oracle, you need:
Configuration
-------------

To configure the Oracle connector as the ``oracle`` catalog, create a file named
``oracle.properties`` in ``etc/catalog``. Include the following connection
properties in the file:
To configure the Oracle connector as the ``example`` catalog, create a file
named ``example.properties`` in ``etc/catalog``. Include the following
connection properties in the file:

.. code-block:: text

Expand Down Expand Up @@ -103,10 +103,10 @@ The Oracle connector provides a schema for every Oracle database.

Run ``SHOW SCHEMAS`` to see the available Oracle databases::

SHOW SCHEMAS FROM oracle;
SHOW SCHEMAS FROM example;

If you used a different name for your catalog properties file, use that catalog
name instead of ``oracle``.
name instead of ``example``.

.. note::
The Oracle user must have access to the table in order to access it from Trino.
Expand All @@ -119,17 +119,17 @@ Examples
If you have an Oracle database named ``web``, run ``SHOW TABLES`` to see the
tables it contains::

SHOW TABLES FROM oracle.web;
SHOW TABLES FROM example.web;

To see a list of the columns in the ``clicks`` table in the ``web``
database, run either of the following::

DESCRIBE oracle.web.clicks;
SHOW COLUMNS FROM oracle.web.clicks;
DESCRIBE example.web.clicks;
SHOW COLUMNS FROM example.web.clicks;

To access the clicks table in the web database, run the following::

SELECT * FROM oracle.web.clicks;
SELECT * FROM example.web.clicks;

.. _oracle-type-mapping:

Expand Down Expand Up @@ -436,7 +436,7 @@ As a simple example, to select an entire table::
*
FROM
TABLE(
oracle.system.query(
example.system.query(
query => 'SELECT
*
FROM
Expand All @@ -454,7 +454,7 @@ As a practical example, you can use the
sales
FROM
TABLE(
oracle.system.query(
example.system.query(
query => 'SELECT
*
FROM
Expand Down
16 changes: 8 additions & 8 deletions docs/src/main/sphinx/connector/phoenix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Configuration
-------------

To configure the Phoenix connector, create a catalog properties file
``etc/catalog/phoenix.properties`` with the following contents,
``etc/catalog/example.properties`` with the following contents,
replacing ``host1,host2,host3`` with a comma-separated list of the ZooKeeper
nodes used for discovery of the HBase cluster:

Expand Down Expand Up @@ -72,25 +72,25 @@ Querying Phoenix tables
The default empty schema in Phoenix maps to a schema named ``default`` in Trino.
You can see the available Phoenix schemas by running ``SHOW SCHEMAS``::

SHOW SCHEMAS FROM phoenix;
SHOW SCHEMAS FROM example;

If you have a Phoenix schema named ``web``, you can view the tables
in this schema by running ``SHOW TABLES``::

SHOW TABLES FROM phoenix.web;
SHOW TABLES FROM example.web;

You can see a list of the columns in the ``clicks`` table in the ``web`` schema
using either of the following::

DESCRIBE phoenix.web.clicks;
SHOW COLUMNS FROM phoenix.web.clicks;
DESCRIBE example.web.clicks;
SHOW COLUMNS FROM example.web.clicks;

Finally, you can access the ``clicks`` table in the ``web`` schema::

SELECT * FROM phoenix.web.clicks;
SELECT * FROM example.web.clicks;

If you used a different name for your catalog properties file, use
that catalog name instead of ``phoenix`` in the above examples.
that catalog name instead of ``example`` in the above examples.

.. _phoenix-type-mapping:

Expand Down Expand Up @@ -216,7 +216,7 @@ Table properties - Phoenix

Table property usage example::

CREATE TABLE myschema.scientists (
CREATE TABLE example_schema.scientists (
recordkey VARCHAR,
birthday DATE,
name VARCHAR,
Expand Down
10 changes: 5 additions & 5 deletions docs/src/main/sphinx/connector/pinot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Configuration
-------------

To configure the Pinot connector, create a catalog properties file
e.g. ``etc/catalog/pinot.properties`` with at least the following contents:
e.g. ``etc/catalog/example.properties`` with at least the following contents:

.. code-block:: text

Expand Down Expand Up @@ -115,12 +115,12 @@ Querying Pinot tables
The Pinot connector automatically exposes all tables in the default schema of the catalog.
You can list all tables in the pinot catalog with the following query::

SHOW TABLES FROM pinot.default;
SHOW TABLES FROM example.default;

You can list columns in the flight_status table::

DESCRIBE pinot.default.flight_status;
SHOW COLUMNS FROM pinot.default.flight_status;
DESCRIBE example.default.flight_status;
SHOW COLUMNS FROM example.default.flight_status;

Queries written with SQL are fully supported and can include filters and limits::

Expand All @@ -137,7 +137,7 @@ Filters and limits in the outer query are pushed down to Pinot.
Let's look at an example query::

SELECT *
FROM pinot.default."SELECT MAX(col1), COUNT(col2) FROM pinot_table GROUP BY col3, col4"
FROM example.default."SELECT MAX(col1), COUNT(col2) FROM pinot_table GROUP BY col3, col4"
WHERE col3 IN ('FOO', 'BAR') AND col4 > 50
LIMIT 30000

Expand Down