I want the tables in SQL Server DB as a nice comma separated list. I have some code as below.
import pyodbc
cnxn = pyodbc.connect('Trusted_Connection=yes',
driver = '{ODBC Driver 13 for SQL Server}',
server = 'XXXXXX\SQLSERVER',
database = 'AdventureWorks2016CTP3')
sql = "SELECT Distinct TABLE_NAME FROM information_schema.TABLES"
cursor = cnxn.cursor()
cursor.execute(sql)
print(cursor.fetchall())
I want the list to be like
['Address', 'AddressType',.....]
instead of
[('Address', ), ('AddressType', ), .....]
How to get this done.
Keerikkattu Chellappan