我有一个带有日期字段的PySpark数据框,我使用JDBC驱动程序将此数据框导出到PostgreSQL数据库。我的数据框有类型
df.dtypes
dt: timestamp
value: double
indi: integer
在写入PostgreSQL之前,我按日期订购了数据框:
df = df.orderBy('dt')
df.write.jdbc(postgre_conn, table='mytable', properties=properties)
但是这个表在PostgreSQL中没有按日期排序。有没有办法在PostgreSQL表中保留数据帧顺序?