Skip to content Skip to sidebar Skip to footer

Copy Dataframe To Postgres Table With Column That Has Defalut Value

I have the following postgreSql table stock, there the structure is following with column insert_time has a default value now() | column | pk | type | +-------------+--

Solution 1:

You can specify columns like this:

cur.copy_from(df, stock, null='', sep=',', columns=('id', 'type', 'c_date', 'qty'))

Post a Comment for "Copy Dataframe To Postgres Table With Column That Has Defalut Value"