How to connect to a database using Python | Python Connect to SQL Server | Query database

preview_player
Показать описание
In this video, we are covering how to connect to a SQL Server database using Python. This is a common question that comes up in the ETL series. So, I decided to cover it and direct viewers to it if they are facing this issue. There are few pre-requisites for this.
We need SQL Server database installed and configured. Link to this video:

Also, we will use Jupyter notebook to troubleshoot the database connection. Jupyter notebook installation is covered in this video here. Video link:

SQL Server ODBC driver 11 for SQL Server for Windows link:

Link to GitHub repo for Notebook:

#python #database #sqlserver

Subscribe to our channel:

-----------------------------------------
Follow me on social media!

-----------------------------------------

Topics covered in this video:
0:00 - SQL Server connection overview
0:41 - Download & Install SQL Server Native Client
1:25 - Jupyter Notebook
1:22 - Jupyter Notebook
2:06 - Database Details
2:48 - Create Database Connection
3:51 - Database setup overview
4:41 - Query Database
5:22 - Common issues & and troubleshooting
Рекомендации по теме
Комментарии
Автор

Hi, I am still getting this error:

InterfaceError: ('28000', "[28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'etl'. (18456) (SQLDriverConnect); [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'etl'. (18456)")

Edit: I fixed the problem. So for future errors like mine, go to SQL management studio, go to > Properties > Security > Server Authentication, and under that check the option "SQL Server and Windows Authentication mode"

This fixed the connection issue.

ooossssss
Автор

Hi so it's Duy again from the ETL video. I noticed that my SQL Server configuration manager didn't have the SQL express, I can only see the Protocols for MSSQLSERVER. Do I have to download it or is there any alternative way? Thank you for all the supports

duynguyenduc
Автор

i got this error- Data extract error: ('28000', "[28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'etlnew'. (18456) (SQLDriverConnect); [28000] [Microsoft][ODBC Driver Manager] Invalid connection string attribute (0); [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'etlnew'. (18456)")

even tho i have changed Server Authentication too

kkxfjch
Автор

Sorry, but I got this error message.

UserWarning: pandas only supports SQLAlchemy connectable (engine/connection) or database string URI or sqlite3 DBAPI2 connection. Other DBAPI2 objects are not tested. Please consider using SQLAlchemy.
df = pd.read_sql_query(sql, con)

tandor
visit shbcf.ru