Questions tagged [ipython-sql]
13 questions
15
votes
5 answers
IPython Notebook and SQL: 'ImportError: No module named sql' when running '%load_ext sql'
Just set up an IPython Notebook on Ubuntu 16.04 but I can't use %load_ext sql.
I get: ImportError: No module named sql
I've tried using pip and pip3 with and without sudo to install ipython-sql. All 4 times it installed without issue but nothing…

user1933275
- 481
- 1
- 5
- 9
7
votes
4 answers
ipython can't load sql
I have installed pip install ipython-sql. I am trying to run
%load_ext sql
but it returns
The sql module is not an IPython extension.
How can I get sql running in ipython?

Echo
- 667
- 3
- 8
- 19
5
votes
2 answers
How to remove connection string info from ipython-sql output?
I'm using the wonderful ipython-sql
But when I get some data from the database I always see the connection string printed out. See image.
How can I stop the connection string from being shown?

ThatDataGuy
- 1,969
- 2
- 17
- 43
1
vote
1 answer
Why does this Sqlite3 query not work using the magical function "%sql" in Jupyter Notebook?
I am having an error while trying to run a query with the magic function %sql in jupyter notebook
My query:
%sql SELECT "Elementary, Middle, or High School" FROM chicago_public_schools_data LIMIT…

Berchister
- 23
- 4
1
vote
1 answer
SQLAlchemy Redshift IAM User Connection String (Python)
I'm able to successfully connect to my Redshift cluster via my IAM role with the following from the redshift_connector package:
import redshift_connector
conn = redshift_connector.connect(
iam=True,
database='dbname',
db_user='user',
…

econgineer
- 1,117
- 10
- 20
1
vote
1 answer
Use Ipython-sql with snowflake and externalbrowser authenticator
in my jupyter notebook I connect to snowflake with an externalbrowser auth like so:
conn = snowflake.connector.connect(
user='',
authenticator='externalbrowser',
account='',
warehouse='')
this opens an external…

Ezer K
- 3,637
- 3
- 18
- 34
0
votes
1 answer
Using CONCAT in column alias
I have a bunch of repeating queries in a Python accessed SQL notebook. I've tested the below
colum_to_agg = f'''data_col_1'''
sql_aggregates_query=f'''
avg({colum_to_agg}) as (concat({colum_to_agg},'_mean')),
max({colum_to_agg}) as…

mapping dom
- 1,737
- 4
- 27
- 50
0
votes
1 answer
ipython-sql same query works with %sql but not with %%sql
I am querying a table using ipython-sql module.
I can execute a query with %sql without any problems. However, I just can't do
with %%sql.
%%sql
SELECT DISTINCT Launch_Site AS Distinct_Launch_Site
FROM spacex
It gives me an error like…

OnurYukay
- 21
- 2
0
votes
0 answers
Running multiple DB connections in parallel from Jupyter Lab
I'm trying to connect to multiple data sources, Postgress, Snowflake and MySQL.
In each of these sources I have some tables that I need to ingest in order to build my models correctly. I know I can do it for each of those individually with…

Ido Michael
- 109
- 7
0
votes
1 answer
Can't connect to MySQL from Jupyter Lab using ipython-sql
I'm running MySQL in a Docker container, and in my jupyter lab I have the following cell:
# Importing module
import mysql.connector
# Creating connection object
mydb = mysql.connector.connect(
host = "localhost",
port = 3307,
user =…

Bobby Wan-Kenobi
- 885
- 9
- 18
0
votes
1 answer
How to use dsn.ini file for odbc connection?
I am trying to connect to the msserver using odbc connection using ipython-sql magic in jupyter notebook.
I was wondering how to use dsn.ini file to load the configuration and connect to the…
user15929966
0
votes
0 answers
unable to use pyodbc on mac
i am trying to use pyodbc to connect to azure sql from python and i am getting this error saying pyodbc module not found although i have it installed as you can see in snippet below:
(apienv) (base) manishshukla@Manishs-MacBook-Pro scriptureApi %…

Manish Shukla
- 313
- 1
- 3
- 17
-2
votes
2 answers
Why is the datatype not working in ipython-sql?
When creating a database table in jupyter, we specify restrictions on data types in the columns of the table, but for some reason we can still add other data types. For example, the st_gr column should contain only numbers, but nothing will stop us…

Kenen
- 3
- 2