Search
 
SCRIPT & CODE EXAMPLE
 

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()
Comment

PREVIOUS NEXT
Code Example
Python :: python list ascii 
Python :: Add help text in Django model forms 
Python :: how to delete print statement from console pythonn 
Python :: django select database for migrate 
Python :: how to change button background color while clicked tkinter python 
Python :: python input comma separated values 
Python :: LookupError: unknown encoding: idna python 
Python :: how to clear the console python 
Python :: send email python 
Python :: change the default python version mac 
Python :: update link python is python 3 
Python :: pandas set font size plot 
Python :: zeller year 
Python :: normalize data python pandas 
Python :: cv2 videocapture nth frame 
Python :: python method to filter vowels in a string 
Python :: python3.9 venv returned non-zero exit status 1 
Python :: open a web page using selenium python 
Python :: discord identity python html avatar 
Python :: python datetime minus 1 day 
Python :: add rows to dataframe pandas 
Python :: pairplot size 
Python :: delete files inside folder python 
Python :: python generate uid 
Python :: how to remove the very last character of a text file in python 
Python :: strftime python 
Python :: how to create file using python cat command 
Python :: get current file location 
Python :: ignore error open file python 
Python :: python markdown indent 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =