Connecting to SQL Server with Python - Python programming for beginners

Pubblicato il: 09 marzo 2023
sul canale di: Brendan Callaghan
794
5

In this python video I will be discussing how to connect to a SQL server and run a simple query

Music by Bensound, www.bensound.com

----Code snippet---------

import dbconfigs as db
import pyodbc

cn1 = pyodbc.connect (r'DRIVER=SQL Server;'
f'server={db.SEVERNAME};'
r'Database=master;'
f'User ID={db.USER};'
f'password={db.PASSWORD}'
)

qry = 'SELECT name from sys.databases'
csr = cn1.cursor()
csr.execute(qry)

dbnames = csr.fetchall()
print(dbnames)

for name in dbnames:
print(name[0])


In questa pagina del sito puoi guardare il video online Connecting to SQL Server with Python - Python programming for beginners della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Brendan Callaghan 09 marzo 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 794 volte e gli è piaciuto 5 spettatori. Buona visione!