tmthyjames / SQLCell

SQLCell is a magic function for the Jupyter Notebook that executes raw, parallel, parameterized SQL queries with the ability to accept Python values as parameters and assign output data to Python variables while concurrently running Python code. And *much* more.
MIT License
151 stars 11 forks source link

make hooks independent of server. #117

Open tmthyjames opened 5 years ago

tmthyjames commented 5 years ago

for instance

%%sql --hook

tables MSS = USE {0};
SELECT * FROM sys.Tables;

columns_mss MSS = EXEC sp_columns {0};

columns_db1 DB1 = EXEC sp_columns {0};

views mssql+pymssql://username:password@hostname/DB = USE {0};
SELECT * FROM sys.Views;

tables_db1 DB1 = USE {0};
SELECT * FROM sys.Tables;

views_l mssql+pymssql://:@localhost/DB = USE {0};
SELECT * FROM sys.Views;

databases LC = SELECT name FROM master.sys.databases;

add server alias as argument so the same shortcut can be used across any server (assuming same sql dialect).