Example of using SQL magics in Deepnote
!pip install ipython-sql
import os
%load_ext sql
%config SqlMagic.autopandas = True
# Here we created a PostgreSQL integration with the name 'reader'. You will need to replace the os.environ variables
connection_string = f'postgresql://{os.environ["READER_USER"]}:{os.environ["READER_PASSWORD"]}@{os.environ["READER_HOST"]}:{os.environ["READER_PORT"]}/{os.environ["READER_DATABASE"]}'
%sql $connection_string
del connection_string
%%sql
select * from user
limit 20