top of page

LBSocial

AI-Powered Python: Low-Code Data Analysis in Jupyter Notebooks

Updated: 11 hours ago


 

Unlock the power of low-code data analysis in Python with generative AI! In this tutorial, you'll learn to query SQL data using Python, integrate OpenAI with your Jupyter Notebook, and streamline your data analysis process. Follow along as we set up PostgreSQL on AWS RDS, securely manage API keys, and leverage AI to explain and generate real-time code.


Data:


 

Steps:

  • Start the PostgreSQL instance on AWS RDS.

  • Store the OpenAI API Key in Secretes Manager

    • Secret name: openai

    • Key name: api_key

  • Start the Notebook Instance in SageMaker and upload the demo notebook.

  • Open the notebook and execute the cells:

    • Install the Python libraries and restart the kernel.

    • Pass credentials, connect to the PostgreSQL database, and load the OpenAI API Key

    • List the available AI models. If openAI is not in the AI mode list, execute this code:

pip install jupyter-ai[all]
  • Define a simple SQL and use pandas to visualize the data

  • Try to use the ai magic commands to explain the code or create new code

  • Close the connection and cursor

  • Use the Git command to upload the notebook to GitHub. Check the uploaded Notebook in GitHub.

  • Stop the Notebook and PostgreSQL instances.


Please note: OpenAI or any LLMs can access your data. Please check Data Privacy Policies or use a locally hosted LLM to process sensitive information.



40 views0 comments

Comments


bottom of page