# Databricks notebook source
dbutils.fs.mounts()

# COMMAND ----------

race_df = spark.read.option("header",True).option("inferSchema",True).csv("/mnt/trialashmita/raw/races.csv")

# COMMAND ----------

display(race_df)

# COMMAND ----------

race_df.printSchema()

# COMMAND ----------

from pyspark.sql.types import IntegerType,StringType,StructType,StructField

# COMMAND ----------

race_schema = StructType(fields=[StructField("raceId",IntegerType(),False),
                                StructField("year",IntegerType(),True),
                                StructField("round",IntegerType(),True),
                                StructField("circuitId",IntegerType(),True),
                                StructField("name",StringType(),True),
                                StructField("date",StringType(),True),
                                StructField("time",StringType(),True),
                                StructField("url",StringType(),True)])

# COMMAND ----------

race_df = spark.read.option("header",True).option("Schema",race_schema).csv("/mnt/trialashmita/raw/races.csv")

# COMMAND ----------

race_select_df = race_df.drop(race_df.url)

# COMMAND ----------

display(race_select_df)

# COMMAND ----------

from pyspark.sql.functions import current_timestamp,col

# COMMAND ----------

race_with_df = race_select_df.withColumn("ingestion_date",current_timestamp())

# COMMAND ----------

display(race_with_df)

# COMMAND ----------


7d8a2423af31c0b79f18e825a4e77c9fdbe291f9
<mask token>

dbutils.fs.mounts()
<mask token>
display(race_df)
race_df.printSchema()
<mask token>
display(race_select_df)
<mask token>
display(race_with_df)

dbutils.fs.mounts()
race_df = spark.read.option('header', True).option('inferSchema', True).csv(
    '/mnt/trialashmita/raw/races.csv')
display(race_df)
race_df.printSchema()
<mask token>
race_schema = StructType(fields=[StructField('raceId', IntegerType(), False
    ), StructField('year', IntegerType(), True), StructField('round',
    IntegerType(), True), StructField('circuitId', IntegerType(), True),
    StructField('name', StringType(), True), StructField('date', StringType
    (), True), StructField('time', StringType(), True), StructField('url',
    StringType(), True)])
race_df = spark.read.option('header', True).option('Schema', race_schema).csv(
    '/mnt/trialashmita/raw/races.csv')
race_select_df = race_df.drop(race_df.url)
display(race_select_df)
<mask token>
race_with_df = race_select_df.withColumn('ingestion_date', current_timestamp())
display(race_with_df)

dbutils.fs.mounts()
race_df = spark.read.option('header', True).option('inferSchema', True).csv(
    '/mnt/trialashmita/raw/races.csv')
display(race_df)
race_df.printSchema()
from pyspark.sql.types import IntegerType, StringType, StructType, StructField
race_schema = StructType(fields=[StructField('raceId', IntegerType(), False
    ), StructField('year', IntegerType(), True), StructField('round',
    IntegerType(), True), StructField('circuitId', IntegerType(), True),
    StructField('name', StringType(), True), StructField('date', StringType
    (), True), StructField('time', StringType(), True), StructField('url',
    StringType(), True)])
race_df = spark.read.option('header', True).option('Schema', race_schema).csv(
    '/mnt/trialashmita/raw/races.csv')
race_select_df = race_df.drop(race_df.url)
display(race_select_df)
from pyspark.sql.functions import current_timestamp, col
race_with_df = race_select_df.withColumn('ingestion_date', current_timestamp())
display(race_with_df)

# Databricks notebook source
dbutils.fs.mounts()

# COMMAND ----------

race_df = spark.read.option("header",True).option("inferSchema",True).csv("/mnt/trialashmita/raw/races.csv")

# COMMAND ----------

display(race_df)

# COMMAND ----------

race_df.printSchema()

# COMMAND ----------

from pyspark.sql.types import IntegerType,StringType,StructType,StructField

# COMMAND ----------

race_schema = StructType(fields=[StructField("raceId",IntegerType(),False),
                                StructField("year",IntegerType(),True),
                                StructField("round",IntegerType(),True),
                                StructField("circuitId",IntegerType(),True),
                                StructField("name",StringType(),True),
                                StructField("date",StringType(),True),
                                StructField("time",StringType(),True),
                                StructField("url",StringType(),True)])

# COMMAND ----------

race_df = spark.read.option("header",True).option("Schema",race_schema).csv("/mnt/trialashmita/raw/races.csv")

# COMMAND ----------

race_select_df = race_df.drop(race_df.url)

# COMMAND ----------

display(race_select_df)

# COMMAND ----------

from pyspark.sql.functions import current_timestamp,col

# COMMAND ----------

race_with_df = race_select_df.withColumn("ingestion_date",current_timestamp())

# COMMAND ----------

display(race_with_df)

# COMMAND ----------

