ploomber / jupysql

Better SQL in Jupyter. 📊
https://jupysql.ploomber.io
Apache License 2.0
722 stars 76 forks source link

%sqlcmd does not support connection choosing (--alias) #1022

Open Hubbitus opened 2 months ago

Hubbitus commented 2 months ago

What happens?

Hello. With %sql magic I be able to create several connections to the databases, but then I cannot list tables, explore and profile them because can't select in %sqlcmd

To Reproduce

%sql duckdb:// --alias db1
> Connecting and switching to connection 'db1'
%sql duckdb:// --alias db2
> Connecting and switching to connection 'db2'
%sqlcmd tables --alias db1
> UsageError: unrecognized arguments: --alias db1
%sqlcmd --alias db1 tables
> UsageError: %sqlcmd has no command: '--alias'. Valid commands are: tables, columns, test, profile, explore, snippets, connect

OS:

Linux

JupySQL Version:

0.10.12

Full Name:

Pavel Alexeev

Affiliation:

GID

edublancas commented 2 months ago

I believe they will all use the existing connection, you can switch to whatever db you want and then run %sqlcmd: https://jupysql.ploomber.io/en/latest/howto.html#switch-connections

Hubbitus commented 2 months ago

@edublancas, that workaround works, thank you. But I think it will be more consistent to have similar switch like in %sql. How you think?