我想使用python将拼花文件转换成超文件格式。下面是用于此的git - https://github.com/tableau/hyper-api-samples/blob/main/Community-Supported/parquet-to-hyper/create_hyper_file_from_parquet.py。但在这种情况下,/schema的拼花格式是事先知道的。如果我想让它对任何parquet文件起作用,我应该做什么,而不管模式如何。关于我,我主要是在python的分析和数据科学领域工作,但是我想在这个项目上工作,让一些文件可以被图形访问。谢谢您,如果您需要更多的信息,请告诉我。
发布于 2022-06-08 20:34:25
发布于 2022-09-11 05:37:46
如果您不希望在从parquet文件创建.hyper文件时定义模式,则可以使用CREATE TABLE
命令而不是COPY
命令。
要使用CREATE TABLE
命令,可以跳过模式和表定义,如下所示:
# Start the Hyper process.
with HyperProcess(telemetry=Telemetry.SEND_USAGE_DATA_TO_TABLEAU) as hyper:
# Open a connection to the Hyper process. This will also create the new Hyper file.
# The `CREATE_AND_REPLACE` mode causes the file to be replaced if it
# already exists.
with Connection(endpoint=hyper.endpoint,
database=hyper_database_path,
create_mode=CreateMode.CREATE_AND_REPLACE) as connection:
connection.execute_command("CREATE TABLE products AS (SELECT * FROM external('products.parquet'))")
https://stackoverflow.com/questions/72210440
复制相似问题