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

cursor description fails with "SHOW TABLES" #38

Closed
tharwan opened this issue Jan 30, 2024 · 1 comment · Fixed by #36
Closed

cursor description fails with "SHOW TABLES" #38

tharwan opened this issue Jan 30, 2024 · 1 comment · Fixed by #36

Comments

@tharwan
Copy link
Contributor

tharwan commented Jan 30, 2024

the following throws an error for me

from snowflake.sqlalchemy import URL
import sqlalchemy
import fakesnow

with fakesnow.patch():
    engine = sqlalchemy.create_engine(
        URL(
            account="abc123",
            user="testuser1",
            password="0123456",
            database="testdb",
            schema="public",
        )
    )
    print(engine.execute("SHOW TABLES").fetchone())

duckdb.duckdb.ParserException: Parser Error: syntax error at or near "TABLES"
LINE 1: DESCRIBE SHOW TABLES

Executing the same command with the curser like so:

import fakesnow
import snowflake.connector

with fakesnow.patch():
    conn = snowflake.connector.connect()

    print(conn.cursor().execute("SHOW TABLES").fetchone())

works just fine.

We ran into this error because our code creates tables using sqlalchemy declarative base, which internally seems to run similar commands. (This also showed a problem with auto increment but I will open a separate ticket for this).

@tekumara
Copy link
Owner

tekumara commented Feb 5, 2024

👍 pending tobymao/sqlglot#2913

tekumara pushed a commit that referenced this issue Feb 8, 2024
🤖 I have created a release *beep* *boop*
---


## [0.9.0](v0.8.2...v0.9.0)
(2024-02-08)


### ⚠ BREAKING CHANGES

* change to Apache License

### Features

* cursor.rowcount now returns count
([8a8264e](8a8264e))
* DESCRIBE TABLE
([7d0d3a7](7d0d3a7))
* EQUAL_NULL
([f108a36](f108a36))
* extract column comments
([27ff048](27ff048))
* include params in debug output
([7452756](7452756))
* SHOW OBJECTS
([84e16e8](84e16e8))
* SHOW SCHEMAS
([74cd1a7](74cd1a7))
* SHOW TABLES
([56f6a0b](56f6a0b)),
closes [#38](#38)
* support description for TIMESTAMP WITH TIME ZONE
([40a3a1e](40a3a1e))
* support description without db/schema + dropping current schema
([3315d99](3315d99))
* support on-disk databases
([6043f3d](6043f3d))
* UPDATE returns number of rows updated
([f1187b1](f1187b1))


### Bug Fixes

* casing in description()
([db35a5d](db35a5d))
* cli passes -m and -d to target
([83254d3](83254d3))
* COMMENT ON supports raw string
([50f0253](50f0253))
* FAKESNOW_DEBUG=snowflake corrupting sql
([81d7e3c](81d7e3c))
* SHOW OBJECTS shows information_schema objects
([6318881](6318881))
* store result set per results set
([69f00a6](69f00a6))
* TO_DATE(VARCHAR)
([c5b5d7b](c5b5d7b))
* write_pandas supports dicts with different keys
([5962801](5962801))


### Chores

* bump sqlglot 21.0.1
([e7c6c6e](e7c6c6e))
* change to Apache License
([ce2e4a5](ce2e4a5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: potatobot-prime[bot] <132267321+potatobot-prime[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants