Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: overwrite = True on postgres backend when using create_table() gives an error #10761

Open
1 task done
nBhabish opened this issue Jan 31, 2025 · 0 comments
Open
1 task done
Labels
bug Incorrect behavior inside of ibis postgres The PostgreSQL backend

Comments

@nBhabish
Copy link

What happened?

So, I am trying to overwrite a table in some schema, and it does not allow me to do so. It does create a table but gives an error and the table does not contain anything. This is the output I get for the table name which was not even close to what I wanted the table name to be: ibis_postgres_table_54lealvsujhbvhag3b3udhoiiq.

Also, I tried adding a brand new table to that particular schema with overwrite = True, and it gave me an error. When I try creating a new table without overwrite = True, I do not get any error.

The object type that I am adding is ibis.expr.types.relations.Table

Here's the code that I ran:
con.create_table('some_data', obj = ibis_df, database='some_schema', overwrite=True)

What version of ibis are you using?

ibis-framework 9.5.0

dependencies on my venv:

Package           Version
----------------- -----------
appnope           0.1.4
astroid           3.3.8
asttokens         3.0.0
atpublic          5.1
comm              0.2.2
debugpy           1.8.12
decorator         5.1.1
dill              0.3.9
duckdb            1.1.3
et_xmlfile        2.0.0
executing         2.2.0
ibis-framework    9.5.0
ipykernel         6.29.5
ipython           8.31.0
isort             6.0.0
jedi              0.19.2
jupyter_client    8.6.3
jupyter_core      5.7.2
markdown-it-py    3.0.0
matplotlib-inline 0.1.7
mccabe            0.7.0
mdurl             0.1.2
nest-asyncio      1.6.0
numpy             2.2.2
openpyxl          3.1.5
packaging         24.2
pandas            2.2.3
parso             0.8.4
parsy             2.1
pexpect           4.9.0
pip               24.0
platformdirs      4.3.6
prompt_toolkit    3.0.50
psutil            6.1.1
psycopg2          2.9.10
psycopg2-binary   2.9.10
ptyprocess        0.7.0
pure_eval         0.2.3
pyarrow           17.0.0
pyarrow-hotfix    0.6
Pygments          2.19.1
pylint            3.3.4
python-dateutil   2.9.0.post0
python-dotenv     1.0.1
pytz              2024.2
pyzmq             26.2.1
rich              13.9.4
six               1.17.0
SQLAlchemy        2.0.37
sqlglot           25.20.2
stack-data        0.6.3
tomlkit           0.13.2
toolz             0.12.1
tornado           6.4.2
traitlets         5.14.3
typing_extensions 4.12.2
tzdata            2025.1
wcwidth           0.2.13

What backend(s) are you using, if any?

Postgres

Relevant log output

SyntaxError                               Traceback (most recent call last)
Cell In[23], line 1
----> 1 con.create_table('some_data', obj = ibis_df, database='some_schema', overwrite=True)

File ~/Documents/neupane/myenv/lib/python3.12/site-packages/ibis/backends/postgres/__init__.py:703, in Backend.create_table(self, name, obj, schema, database, temp, overwrite)
    699     if overwrite:
    700         cur.execute(
    701             sge.Drop(kind="TABLE", this=this, exists=True).sql(self.dialect)
    702         )
--> 703         cur.execute(
    704             f"ALTER TABLE IF EXISTS {table_expr.sql(self.dialect)} RENAME TO {this.sql(self.dialect)}"
    705         )
    707 if schema is None:
    708     return self.table(name, database=database)

SyntaxError: syntax error at or near "."
LINE 1: ...g3b3udhoiiq" RENAME TO "some_schema"."some_dat...

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nBhabish nBhabish added the bug Incorrect behavior inside of ibis label Jan 31, 2025
@cpcloud cpcloud added the postgres The PostgreSQL backend label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis postgres The PostgreSQL backend
Projects
Status: backlog
Development

No branches or pull requests

2 participants