title | slug | keywords | license | |||
---|---|---|---|---|---|---|
PostgreSQL catalog |
/jdbc-postgresql-catalog |
|
This software is licensed under the Apache License version 2. |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Apache Gravitino provides the ability to manage PostgreSQL metadata.
:::caution
Gravitino saves some system information in schema and table comment, like (From Gravitino, DO NOT EDIT: gravitino.v1.uid1078334182909406185)
, please don't change or remove this message.
:::
- Gravitino catalog corresponds to the PostgreSQL database.
- Supports metadata management of PostgreSQL (12.x, 13.x, 14.x, 15.x, 16.x).
- Supports DDL operation for PostgreSQL schemas and tables.
- Supports table index.
- Supports column default value. and auto-increment.
Any property that isn't defined by Gravitino can pass to PostgreSQL data source by adding gravitino.bypass.
prefix as a catalog property. For example, catalog property gravitino.bypass.maxWaitMillis
will pass maxWaitMillis
to the data source property.
You can check the relevant data source configuration in data source properties
When you use the Gravitino with Trino. You can pass the Trino PostgreSQL connector configuration using prefix trino.bypass.
. For example, using trino.bypass.join-pushdown.strategy
to pass the join-pushdown.strategy
to the Gravitino PostgreSQL catalog in Trino runtime.
If you use JDBC catalog, you must provide jdbc-url
, jdbc-driver
, jdbc-database
, jdbc-user
and jdbc-password
to catalog properties.
Besides the common catalog properties, the PostgreSQL catalog has the following properties:
Configuration item | Description | Default value | Required | Since Version |
---|---|---|---|---|
jdbc-url |
JDBC URL for connecting to the database. You need to specify the database in the URL. For example jdbc:postgresql://localhost:3306/pg_database?sslmode=require . |
(none) | Yes | 0.3.0 |
jdbc-driver |
The driver of the JDBC connection. For example org.postgresql.Driver . |
(none) | Yes | 0.3.0 |
jdbc-database |
The database of the JDBC connection. Configure it with the same value as the database in the jdbc-url . For example pg_database . |
(none) | Yes | 0.3.0 |
jdbc-user |
The JDBC user name. | (none) | Yes | 0.3.0 |
jdbc-password |
The JDBC password. | (none) | Yes | 0.3.0 |
jdbc.pool.min-size |
The minimum number of connections in the pool. 2 by default. |
2 |
No | 0.3.0 |
jdbc.pool.max-size |
The maximum number of connections in the pool. 10 by default. |
10 |
No | 0.3.0 |
:::caution
You must download the corresponding JDBC driver to the catalogs/jdbc-postgresql/libs
directory.
You must explicitly specify the database in both jdbc-url
and jdbc-database
. An error may occur if the values in both aren't consistent.
:::
:::info
In PostgreSQL, the database corresponds to the Gravitino catalog, and the schema corresponds to the Gravitino schema.
:::
Please refer to Manage Relational Metadata Using Gravitino for more details.
- Gravitino schema corresponds to the PostgreSQL schema.
- Supports creating schema with comments.
- Supports dropping schema.
- Supports cascade dropping schema.
- Doesn't support any schema property settings.
Please refer to Manage Relational Metadata Using Gravitino for more details.
- The Gravitino table corresponds to the PostgreSQL table.
- Supports DDL operation for PostgreSQL tables.
- Supports index.
- Support column default value and auto-increment.
- Doesn't support table property settings.
Gravitino Type | PostgreSQL Type |
---|---|
Boolean |
Bool |
Short |
Int2 |
Integer |
Int4 |
Long |
Int8 |
Float |
Float4 |
Double |
Float8 |
String |
Text |
Date |
Date |
Time |
Time |
Timestamp |
Timestamp |
Timestamp_tz |
Timestamptz |
Decimal |
Numeric |
VarChar |
Varchar |
FixedChar |
Bpchar |
Binary |
Bytea |
List |
Array |
:::info
PostgreSQL doesn't support Gravitino Fixed
Struct
Map
IntervalDay
IntervalYear
Union
UUID
type.
Meanwhile, the data types other than listed above are mapped to Gravitino External Type that represents an unresolvable data type since 0.6.0.
:::
- Supports setting auto-increment.
- Doesn't support table properties.
- Supports PRIMARY_KEY and UNIQUE_KEY.
{
"indexes": [
{
"indexType": "primary_key",
"name": "id_pk",
"fieldNames": [["id"]]
},
{
"indexType": "unique_key",
"name": "id_name_uk",
"fieldNames": [["id"] ,["name"]]
}
]
}
Index[] indexes = new Index[] {
Indexes.of(IndexType.PRIMARY_KEY, "PRIMARY", new String[][]{{"id"}}),
Indexes.of(IndexType.UNIQUE_KEY, "id_name_uk", new String[][]{{"id"} , {"name"}}),
}
Please refer to Manage Relational Metadata Using Gravitino for more details.
Supports operations:
RenameTable
UpdateComment
AddColumn
DeleteColumn
RenameColumn
UpdateColumnType
UpdateColumnNullability
UpdateColumnComment
UpdateColumnDefaultValue
:::info
You can't submit the RenameTable
operation at the same time as other operations.
:::
:::caution
PostgreSQL doesn't support the UpdateColumnPosition
operation, so you can only use ColumnPosition.defaultPosition()
when AddColumn
.
If you update a nullability column to non nullability, there may be compatibility issues.
:::