How To Read Data From SQL Server Using Python

preview_player
Показать описание
Read Data From SQL Server Using Python

Python is an interpreted high-level general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation. Its language constructs as well as its object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly, procedural), object-oriented and functional programming. Python is often described as a "batteries included" language due to its comprehensive standard library.

Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network (including the Internet). Microsoft markets at least a dozen different editions of Microsoft SQL Server, aimed at different audiences and for workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users.

Pyodbc is an open source Python module that makes accessing ODBC databases simple. It implements the DB API 2.0 specification. Using pyodbc, you can easily connect Python applications to data sources with an ODBC driver.

As with other application stacks connecting through the ODBC API, the application—in this case your python code along with the pyodbc module—will use an ODBC driver manager and ODBC driver. The ODBC driver manager is platform-specific, while the ODBC driver is database-specific. The ODBC driver manager and driver will connect, typically over a network, to the database server.

#pythonprogramming
#sql
#sqlserver
#python
#odbc
#ReadData
Рекомендации по теме
Комментарии
Автор

Thank you for this short and clean Tutorial

EA-brii
Автор

the voice is not clear. be confident and talk confident as well as louder, clear..
the video and explanation is good.

Gundalamanish
Автор

I actually have a path '\\a\b\c\d' in my Sql server and after I read it in python it shows '\\\\a\\b\\c\\d'; then I tried .replace('\\\\', '\\') now it shows '\\a\\b\\c\\d'. Any suggestions as how to get the desired output: '\\a\b\c\d' ?

onomatopoeia
Автор

Thank you, now i have learn to write simple scripts from your tutorial

nurzulhafizyacob
Автор

Thanks for this...question...is there a way to read a *.sql file directly into python? I'm assuming its similar to reading a *.txt file?

Kajan
Автор

Thanks for the video and excellent explanation.
The output in your video is showing with paranthesis, quotes and coma. Am also getting the same output

(11, 'Habeeb', 'ali', 'dfkjds', 'ldjflj', 'Your First Pet Name', 'raju', '1234')

can we change the output to this format:
11 Habeeb ali dfkjds ldjflj Your First Pet Name raju 1234

conn = pyodbc.connect('Driver={SQL Server};'

'Database=budget;'
'Trusted_Connection=yes;')
cur = conn.cursor()
cur.execute("select * from Login")
for row in cur:
print(row)

yourownparamour