0

I have an Exasol table with an autoincrement primary key and want to fill it using import_from_pandas from pyexasol.

By importing to exasol table I have to leave the RKEY out since Exasol auto increments it. But leaving rkey empty or not creating the rkey column in pandas at all doesn’t work for me.

I went through pandas.to_csv and it doesn’t seem to have an option to leave out columns when writing to csv.

import pandas as pd
import pyexasol

score = pd.DataFrame(columns = ['rkey','score'])
score['score'] = list(range(10))
conn = pyexasol.connect(dsn=dsn,user=user, password=pw,compression=True)
conn.import_from_pandas(score,(schema, table))

Does anybody have a solution to this problem?

ipaleka
  • 3,745
  • 2
  • 13
  • 33
luuuusss
  • 1
  • 1
  • Exasol does not behave identity columns as a constraint, I mean you can insert multiple values, or insert explicit values into an identity column on an Exasol table. So it seems to be quite flexible for a developer – Eralper Feb 26 '20 at 15:26

1 Answers1

0

Try this. It works.

conn.import_from_pandas(score,(schema, table),import_params=    {'columns':list(score.columns)})
Alper Kucukkomurler
  • 1,706
  • 2
  • 13
  • 19