GitHub user alberttwong closed a discussion: End to End xtable to Trino query with source delta and target Iceberg and hudi with HMS and S3
Using openjdk 11, spark 3.4, hive 2.3.10, hadoop 2.10.2 using https://github.com/alberttwong/incubator-xtable/tree/main/demo-s3 as the base ``` from pyspark.sql.types import * from pyspark import SparkContext from pyspark.sql import SparkSession import os # initialize the bucket database_name = "delta_db" table_name = "people" local_base_path = "s3a://warehouse" records = [ (1, 'John', 25, 'NYC', '2023-09-28 00:00:00'), (2, 'Emily', 30, 'SFO', '2023-09-28 00:00:00'), (3, 'Michael', 35, 'ORD', '2023-09-28 00:00:00'), (4, 'Andrew', 40, 'NYC', '2023-10-28 00:00:00'), (5, 'Bob', 28, 'SEA', '2023-09-23 00:00:00'), (6, 'Charlie', 31, 'DFW', '2023-08-29 00:00:00') ] schema = StructType([ StructField("id", IntegerType(), True), StructField("name", StringType(), True), StructField("age", IntegerType(), True), StructField("city", StringType(), True), StructField("create_ts", StringType(), True) ]) df = spark.createDataFrame(records, schema) ( df.write .format("delta") .partitionBy("city") .save(f"{local_base_path}/{table_name}") ) ``` GitHub link: https://github.com/apache/incubator-xtable/discussions/461 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
