CREATE-DATABASE
Name
CREATE DATABASE
Description
This statement is used to create a new database (database)
grammar:
1. CREATE DATABASE [IF NOT EXISTS] db_name
2. [PROPERTIES ("key"="value", ...)];
PROPERTIES Additional information about the database, which can be defaulted.
- If you create an Iceberg database, you need to provide the following information in properties:
1. PROPERTIES (
2. "iceberg.database" = "iceberg_db_name",
3. "iceberg.hive.metastore.uris" = "thrift://127.0.0.1:9083",
4. "iceberg.catalog.type" = "HIVE_CATALOG"
5. )
illustrate:
ceberg.database: the library name corresponding to Iceberg;iceberg.hive.metastore.uris: hive metastore service address;iceberg.catalog.type: The default isHIVE_CATALOG; currently onlyHIVE_CATALOGis supported, and more Iceberg catalog types will be supported in the future.- If you want to specify the default replica distribution for tables in db, you need to specify
replication_allocation(thereplication_allocationattribute of table will have higher priority than db)
1. PROPERTIES (
2. "replication_allocation" = "tag.location.default:3"
3. )
Example
- Create a new database db_test
1. CREATE DATABASE db_test;
2. Create a new Iceberg database iceberg_test
1. CREATE DATABASE `iceberg_test`
2. PROPERTIES (
3. "iceberg.database" = "doris",
4. "iceberg.hive.metastore.uris" = "thrift://127.0.0.1:9083",
5. "iceberg.catalog.type" = "HIVE_CATALOG"
6. );
Keywords
1. CREATE, DATABASE
