-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_schema.py
60 lines (52 loc) · 2.23 KB
/
_schema.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Databricks notebook source
from pyspark.sql.types import IntegerType,DecimalType,LongType,BooleanType,DateType,TimestampType,StringType,StructType,StructField,ShortType
customer_schema = StructType(
[
StructField("customerid", LongType(), False),
StructField("firstname", StringType(), True),
StructField("lastname", StringType(), True),
StructField("email", StringType(), True),
StructField("phone", StringType(), True),
StructField("address", StringType(), True),
StructField("created_timestamp", TimestampType(), False),
StructField("updated_timestamp", TimestampType(), True)
]
)
product_schema = StructType(
[
StructField("productid", LongType(), False),
StructField("product_name", StringType(), True),
StructField("product_description", StringType(), True),
StructField("price", DecimalType(10,2), True),
StructField("created_timestamp", TimestampType(), False),
StructField("updated_timestamp", TimestampType(), True)
]
)
order_schema = StructType(
[
StructField("orderid", LongType(), False),
StructField("customerid", LongType(), False),
StructField("order_date", DateType(), True),
StructField("order_amount", DecimalType(10,2), True),
StructField("status", StringType(), False),
StructField("created_timestamp", TimestampType(), False),
StructField("updated_timestamp", TimestampType(), True)
]
)
lineitem_schema = StructType(
[
StructField("orderid", LongType(), False),
StructField("lineitemid", LongType(), False),
StructField("productid", LongType(), False),
StructField("quantity", DecimalType(10,2), True),
StructField("lineitem_amount", DecimalType(10,2), True),
StructField("returnflag", StringType(), True),
StructField("shipment_date", DateType(), True),
StructField("estimated_delivery_date", DateType(), True),
StructField("actual_delivery_date", DateType(), True),
StructField("status", StringType(), False),
StructField("created_timestamp", TimestampType(), False),
StructField("updated_timestamp", TimestampType(), True)
]
)
# COMMAND ----------