I have a PySpark dataframe with a date field and I'm exporting this dataframe to a PostgreSQL database using the JDBC driver. I dataframe has types
df.dtypes
dt: timestamp
value: double
indi: integer
and before writing to PostgreSQL I order the dataframe by date:
df = df.orderBy('dt')
df.write.jdbc(postgre_conn, table='mytable', properties=properties)
but the table is not ordered in PostgreSQL by date. Is there a way to keep the dataframe order in the PostgreSQL table?