I would like to open a SQL 2005 database (the file has the extension .mdf), and I tried this as such:
import pandas as pd import pyodbc server = 'server_name' db = 'database_name' conn = pyodbc.connect('DRIVER={SQL Server};SERVER=' + server + ';DATABASE=' + db + ';Trusted_Connection=yes') sql = """ SELECT * FROM table_name """ df = pd.read_sql(sql, conn)
Is there a way to query the database and list all the tables using Pandas or pyodbc? I have practically no experience with databases, so any help would be great.
source share