def write_db(dataset):
    if dataset.empty:
        print("No data to insert into database")
    else:
        #dataset.to_csv("Agg_Data.csv",index=False)
        dest_table=GuruTable(table_name='ura_private_units_sold')
        dest_table.truncate()
        for i in range(len(dataset)):
            insert_row(dataset.iloc[i],dest_table)
def insert_row(row):
    dest_table=GuruTable(table_name='ura_private_units_sold')
    #print(row)
    dest_table.insert().values(
        year=row["year"],
        month=row["month"],
        developer=row["Developer"],
        property_type=row["Property Type"],
        locality=row["Locality"],
        street_name=row["Street Name"],
        project_name=row["Project Name"],
        total_units_projects=row["Total Number of Units in Project"],
        cumulative_units_launched=row["Cumulative Units Launched to-date"],
        cumulative_units_sold=row["Cumulative Units Sold to-date"],
        total_unsold_units=row["Total Number of Unsold Units"],
        cumulative_units_launched_unsold=row["Cumulative Units Launched but Unsold"],
        units_launched_month=row["Units Launched in the Month"],
        units_sold_month=row["Units Sold in the Month"],
        median_price_psf_month=row["Median Price ($psf) # in the Month"],
        lowest_price_psf_month=row["Lowest Price ($psf) # in the Month"],
        highest_price_psf_month=row["Highest Price ($psf) # in the Month"],
        modified_date=dt.datetime.now()
    ).execute()