File "/home/user/.local/lib/python3.6/site-packages/pandas/core/generic.py", line 2712, in to_sql
method=method,
File "/home/user/.local/lib/python3.6/site-packages/pandas/io/sql.py", line 498, in to_sql
raise ValueError("'{0}' is not valid for if_exists".format(if_exists))
ValueError: 'tableName' is not valid for if_exists
That's the error I get when I'm trying to ingest data into a postgres table through sqlalchemy. It worked before, but recently it's not going through. Here's the code that prompted the error:
data.to_sql(tableName,
engine=db.create_engine(self.dbString),
if_exists='replace',
schema='public')
I can ingest the data into a new table, but that new table is also unable to be dropped with another ingestion attempt with if_exist='replace'.
Is there a permission problem or another problem? I tried changing the connection string to login as superuser postgres will all the permissions and that didn't change anything. The default user I'm using has all the permissions except RLS.