I would like to open an SQL 2005 database (file has extension of .mdf), and I have been trying 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 tables using Pandas or pyodbc? I have virtually NO experience in databases, so any help will be great.