
Добавил:
KaFaka
t.me
Инфо для ГУАП студентов от меня: https://kafaka.notion.site/99e6d9b70ca74f7baef3daea17839e5a
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:4 курс 1 семестр / Лабораторные / Python / LR7_2
.py import pandas as pd
import psycopg2
connection = psycopg2.connect(database="students",
user="postgres",
password="123",
host="127.0.0.1",
port="5432")
cursor = connection.cursor()
cursor.execute('''CREATE TABLE if not exists public.locations
(location_id int PRIMARY KEY,
city varchar(30),
postal_code varchar(12)
); ''')
connection.commit()
cursor.close()
connection.close()
import psycopg2
connection = psycopg2.connect(database="students",
user="postgres",
password="123",
host="127.0.0.1",
port="5432")
cursor = connection.cursor()
cursor.execute('''CREATE TABLE if not exists public.locations
(location_id int PRIMARY KEY,
city varchar(30),
postal_code varchar(12)
); ''')
connection.commit()
cursor.close()
connection.close()
Соседние файлы в папке Python