ipython-sql
ipython-sql copied to clipboard
Use variables as table names
Hi!
I would like to use a variable as table name. However, just doing something like
table_name = 'my_table'
%sql select count() from :table_name
does not work because :table_name is substituted to 'my_table', which is not a valid table in the database that I use (ClickHouse).
Is there a way to set table names from variables, yet use magic and not bare SQLAlchemy?
%sql select count() from {table_name}