Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify SERDEPROPERTIES and TBLPROPERTIES when creating Hive table via prestosql

Tags:

hive

presto

trino

I'm trying to follow the examples of Hive connector to create hive table. I can write HQL to create a table via beeline. But wonder how to make it via prestosql.

Given table

CREATE TABLE hive.web.request_logs (
  request_time varchar,
  url varchar,
  ip varchar,
  user_agent varchar,
  dt varchar
)
WITH (
  format = 'CSV',
  partitioned_by = ARRAY['dt'],
  external_location = 's3://my-bucket/data/logs/'
)
  1. How to specify SERDEPROPERTIES like separatorChar and quoteChar?
  2. How to specify TBLPROPERTIES like skip.header.line.count?
like image 376
shawnzhu Avatar asked Jan 17 '26 23:01

shawnzhu


1 Answers

In Presto you do this like this:

CREATE TABLE table_name( ... columns ... )
WITH (format='CSV', csv_separator='|', skip_header_line_count=1);

You can list all supported table properties in Presto with

SELECT * FROM system.metadata.table_properties;
like image 82
Piotr Findeisen Avatar answered Jan 21 '26 07:01

Piotr Findeisen