Home > Software design >  Can i connect my company's SQL server with python and pull data
Can i connect my company's SQL server with python and pull data

Time:08-07

I want to connect my company's SQL database with python to pull the data and paste it in a dataframe. Is it possible. could you please help me with sample code

CodePudding user response:

There is not much detail in your question, so I will tell the steps.

  1. You will need to install a driver or a module (like pyodbc or mysql-sql-connector-python). This is to help python app interact with an SQL application.
  2. Now you will have to create an instance of connection with appropriate login credentials and the database name you want to connect to.
  3. Finally you can read the data onto dataframe directly by using pandas.read_sql(query, conn).

This link I hope will help you with sample snippet and more details

  • Related