Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

postgres python

import psycopg2

conn = psycopg2.connect(database="<Your database>", user="postgres", 
                        password="<Your password>", port="5432")
cursor = conn.cursor()
# To receive data results
cursor.execute('''SELECT * FROM table;''')
# This will return a list of tuples with all of the relation data
result = cursor.fetchall()
# Only fetching one result
result_from_one = cursor.fetchone()
 
PREVIOUS NEXT
Tagged: #postgres #python
ADD COMMENT
Topic
Name
4+1 =