old_contents: import pypyodbc
  import csv
  
  conn = pypyodbc.connect("DSN=HOSS_DB")
  cur = conn.cursor()
  
  tables = []
  
  cur.execute("select * from sys.tables")
  
  for row in cur.fetchall():
      tables.append(row[0])
  
  for table in tables:
      print(table)
  
      cur.execute("select * from {}".format(table))
  
      column_names = []
  
      for d in cur.description:
          column_names.append(d[0])
  
  #    file = open("{}.csv".format(table), "w", encoding="ISO-8859-1")
      file = open("{}.csv".format(table), "w", encoding="utf-8")
      writer = csv.writer(file, lineterminator='\n')
      writer.writerow(column_names)
  
      for row in cur.fetchall():
          writer.writerow(row)
  
      file.close()
  
new_contents: import pypyodbc
  import csv
  
  conn = pypyodbc.connect("")
  cur = conn.cursor()
  
  tables = []
  
  cur.execute("select * from sys.tables")
  
  for row in cur.fetchall():
      tables.append(row[0])
  
  for table in tables:
      print(table)
  
      cur.execute("select * from {}".format(table))
  
      column_names = []
  
      for d in cur.description:
          column_names.append(d[0])
  
      file = open("{}.csv".format(table), "w", encoding="utf-8")
      writer = csv.writer(file, lineterminator='\n')
      writer.writerow(column_names)
  
      for row in cur.fetchall():
          writer.writerow(row)
  
      file.close()
  
subject: Remove unneeded lines.