简体   繁体   English

使用 Trino 从 S3 读取一个 CSV 文件

[英]Read a CSV file from S3 using Trino

Scenario:设想:

I upload a CSV file into a S3 bucket and now I would like to read this table using Trino.我将一个 CSV 文件上传到 S3 存储桶中,现在我想使用 Trino 读取该表。

Is it possible to just read the table without the CREATE TABLE statement?是否可以在没有 CREATE TABLE 语句的情况下只读取表? Maybe simple SELECT only?也许只有简单的 SELECT? Or I have to CREATE TABLE everytime I want to read the CSV file?或者每次我想读取 CSV 文件时都必须创建表?

You can use the COPY command to load the data without having to create a table first.您可以使用COPY命令加载数据,而无需先创建表。

Once the data is loaded use SELECT to query your data.加载数据后,使用SELECT查询您的数据。

Example:例子:

COPY table FROM 's3://bucket_name/file.csv' WITH (format='csv');
SELECT * FROM table;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM