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

Executing 2 statements within %%sql fails in DuckDB #674

Closed
Alex-Monahan opened this issue Jun 27, 2023 · 5 comments · Fixed by #768
Closed

Executing 2 statements within %%sql fails in DuckDB #674

Alex-Monahan opened this issue Jun 27, 2023 · 5 comments · Fixed by #768

Comments

@Alex-Monahan
Copy link

Hello! I believe this behavior used to work and that this is a regression. It may be related to the pandas output setting.

%%sql
create temp table my_table as select 42;
select * from my_table;

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-17-8fe54b1c3afd>](https://localhost:8080/#) in <cell line: 1>()
----> 1 get_ipython().run_cell_magic('sql', '', 'create temp table my_table as select 42;\nselect * from my_table;\n')

13 frames
<decorator-gen-124> in execute(self, line, cell, local_ns)

<decorator-gen-123> in execute(self, line, cell, local_ns)

<decorator-gen-122> in execute(self, line, cell, local_ns)

<decorator-gen-121> in execute(self, line, cell, local_ns)

[/usr/local/lib/python3.10/dist-packages/duckdb_engine/__init__.py](https://localhost:8080/#) in __getattr__(self, name)
    104 
    105     def __getattr__(self, name: str) -> Any:
--> 106         return getattr(self.__c, name)
    107 
    108     @property

AttributeError: 'duckdb.DuckDBPyConnection' object has no attribute 'dialect'

Here is a google collab that can reproduce the issue: https://colab.research.google.com/drive/1xKjvILJkydM5R095GOVo3hf8446-iZa9?usp=sharing

@edublancas
Copy link

hi @Alex-Monahan, I was able to reproduce the issue. I believe we introduce this when we added support for generic DB API drivers, we'll fix it!

@Alex-Monahan
Copy link
Author

Thank you as always! Having this be a living, breathing, improving project is tremendous. Awesome stuff!

@edublancas
Copy link

hey @Alex-Monahan, update: while working on fixing this we realized that there's some deeper bug involved. so thanks a lot for bringing this up! It'll take a bit more time than expected to fix it but we'll take care of it

@edublancas
Copy link

edublancas commented Aug 1, 2023

hey @Alex-Monahan this has been fixed in 0.9.0, which we released just now! Sorry it took so long; we found out this and other issues were related so we decided to do a big refactoring to close them all at once instead of doing some quick patch.

if you have any other problems, feel free to open another issue!

@Alex-Monahan
Copy link
Author

Great! It's working again in my test case. Thanks for all the work you to do integrate with DuckDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants