Skip to content

allow passing an engine directly to Connection #216

Open

Description

@machow

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

Activity

  1. edublancas commented on Dec 28, 2022

    @edublancas

    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
  2. machow commented on Jan 5, 2023

    @machow
    Author

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions