“Postgres Python” Kod odpowiedzi

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()
Arrogant Alpaca

Python do PostgreSql

from sqlalchemy import create_engine
engine = create_engine('postgresql://postgres:admin1@localhost:5432/postgres')
Condemned Cowfish

Odpowiedzi podobne do “Postgres Python”

Pytania podobne do “Postgres Python”

Więcej pokrewnych odpowiedzi na “Postgres Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu