python操作数据库(PostgreSQL)并将数据(包含列名)写到csv档,以“,”分隔
import psycopg2import boto3stmt = """SELECT film.film_id, title, inventory_idFROM filmLEFT JOIN inventory ON inventory.film_id = film.film_idORDER BY title;"""#创建数据库连接db_conn = psycopg2.connect(host='数据库连