mirror of
https://github.com/IgorL123/mafia_api.git
synced 2026-09-23 23:20:19 +00:00
28 lines
489 B
Python
28 lines
489 B
Python
import psycopg2
|
|
|
|
|
|
db_params = {
|
|
'host': '51.250.68.42',
|
|
'database': 'test',
|
|
'user': 'curator',
|
|
'password': '4oumQk'
|
|
}
|
|
|
|
|
|
try:
|
|
connection = psycopg2.connect(**db_params)
|
|
cursor = connection.cursor()
|
|
|
|
# Ваш код выполнения запросов
|
|
|
|
cursor.execute("SELECT * FROM chats")
|
|
rows = cursor.fetchall()
|
|
|
|
for row in rows:
|
|
print(row)
|
|
|
|
cursor.close()
|
|
connection.close()
|
|
|
|
except Exception as e:
|
|
print("Ошибка:", e) |