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

allow passing an engine directly to Connection #216

Open
machow opened this issue Nov 9, 2022 · 2 comments
Open

allow passing an engine directly to Connection #216

machow opened this issue Nov 9, 2022 · 2 comments

Comments

@machow
Copy link

machow commented Nov 9, 2022

Hello--I've really enjoyed using ipython-sql! One challenge I have is that it requires creating a new engine, rather than using an existing one.

I can work around this by having Connection create the engine, and the grabbing it off of that. However, working with all the tools that can take a sqlalchemy engine feels bit easier, if I can make it upfront and then pass it to them.

Thanks for all your work on this tool!

edit: here's the current workaround:

from sql.connection import Connection

con = Connection("duckdb:///:memory:")
con.session.engine
@edublancas
Copy link

This has been added to JupySQL 0.5.1 (a fork of ipython-sql):

pip install jupysql --upgrade
import pandas as pd
from sqlalchemy.engine import create_engine

engine = create_engine("sqlite://")

df = pd.DataFrame({"x": range(5)})
df.to_sql("numbers", engine)

%load_ext SQL
%sql engine
%%sql
SELECT * FROM numbers

@machow
Copy link
Author

machow commented Jan 5, 2023

Ah thanks! I noticed one of the other additions is telemetry from ploomber_core that is opt out. Can you say more about what that's doing?

pmfischer pushed a commit to pmfischer/ipython-sql that referenced this issue Sep 8, 2023
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

No branches or pull requests

2 participants