Skip to content

Instantly share code, notes, and snippets.

@diafour
Created January 7, 2021 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diafour/d601a5f5adfc02549a47e12815f40964 to your computer and use it in GitHub Desktop.
Save diafour/d601a5f5adfc02549a47e12815f40964 to your computer and use it in GitHub Desktop.
python psycopg2 fetchall
cur = self.conn.cursor()
cur.execute(
"""
SELECT
user_id
FROM
user_state
"""
)
user_ids = cur.fetchall()
for row in user_ids:
print(f"{row[0]}")
cur.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment