Issue
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
Solution
There is not much detail in your question, so I will tell the steps.
- You will need to install a driver or a module (like
pyodbc
ormysql-sql-connector-python
). This is to help python app interact with an SQL application. - Now you will have to create an instance of connection with appropriate login credentials and the database name you want to connect to.
- 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
Answered By - vIra glugulan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.