I have some data set in a pandas data frame that I wish to write to Vertica. I\'ve already created my table using the vertica_python library. What is the best way to write my da
Often when connecting to Vertica, you can use Postgresql as a stand-in since certain parts of Vertica were originally based on Postgresql.
from sqlalchemy import create_engine
engine = create_engine('postgresql://user:pass@host:5433/MYDB')
df.to_sql('table_name', engine)
If this doesn't work you could try out the vertica-sqlalchemy package.
Also, depending on the SQL created (and if the ODBC driver converts INSERT
to a COPY
) this might be very slow. If you find that it is doing lots of individual inserts on the database, you'll probably want to switch to a COPY
method where you create strings and COPY FROM STDIN
to make it faster.