databend icon indicating copy to clipboard operation
databend copied to clipboard

show external location table miss the path option

Open BohuTANG opened this issue 1 year ago • 2 comments

Summary

Create external location table:

CREATE CONNECTION test 
    STORAGE_TYPE = 's3' 
    SECRET_ACCESS_KEY = '<your-secret-access-key>' 
    ACCESS_KEY_ID = '<your-access-key-id>';

CREATE TABLE t1(id int) 's3://xx/yy/zz' CONNECTION=(CONNECTION_NAME='test');
show create table t1;
---
CREATE TABLE t1 (
    id INT NULL
) ENGINE = FUSE
COMPRESSION = 'zstd'
STORAGE_FORMAT = 'parquet';

Expect:

CREATE TABLE t1 (
    id INT NULL
) ENGINE = FUSE
COMPRESSION = 'zstd'
STORAGE_FORMAT = 'parquet'
's3://xx/yy/zz'
CONNECTION = (
    CONNECTION_NAME = 'test'
);

BohuTANG avatar Feb 22 '24 11:02 BohuTANG

Not sure can we do this? @youngsofun

BohuTANG avatar Feb 22 '24 11:02 BohuTANG

CONNECTION itself is not stored, it is translated to StorageParams when create fuse table.

To achieve this effect, need to either

  1. able to restore CONNECTION from StorageParams
  2. store CONNECTION in table meta, solely for use of show create table.

more over, it show create table shows CONNECTION_NAME = 'test', the connection should ref to the connection object even after table creation, and resolve each time of read.

youngsofun avatar Feb 26 '24 02:02 youngsofun

Thank you for the clarification. I will now close this issue.

BohuTANG avatar Feb 28 '24 03:02 BohuTANG

Another question, can we show the external localtion table as:

CREATE TABLE t1 (
    id INT NULL
) ENGINE = FUSE
COMPRESSION = 'zstd'
STORAGE_FORMAT = 'parquet'
's3://xx/yy/zz' -- show this option

to know a table is external location or a normal table.

Now, we don't konw a table is external location or not, because it show create table is:

show create table t1;
---
CREATE TABLE t1 (
    id INT NULL
) ENGINE = FUSE
COMPRESSION = 'zstd'
STORAGE_FORMAT = 'parquet';

cc @ariesdevil

BohuTANG avatar Feb 28 '24 03:02 BohuTANG

The endpoint_url is also part of StorageParams

ariesdevil avatar Feb 28 '24 06:02 ariesdevil