Untitled

mail@pastecode.io avatar
unknown
plain_text
25 days ago
972 B
4
Indexable
Never
import psycopg2
import pandas as pd
import numpy as np

conn = psycopg2.connect("host='localhost' port='5432' dbname='de' user='jovyan' password='jovyan'")
# переменная conn создаёт подключение к БД
cur = conn.cursor()  

cur.execute("CREATE TABLE stage.user_activity_log(ID serial not null,date_time          TIMESTAMP ,action_id             BIGINT ,customer_id             BIGINT ,quantity             BIGINT ,PRIMARY KEY (ID));")

cur.execute("create table stage.customer_research (date_id timestamp not null,category_id integer,geo_id integer,sales_qty integer,sales_amt numeric,sales_qty numeric, primary key (date_id));")

cur.execute("create table stage.user_order_log (id serial not null,uniq_id text,date_time timestamp,city_id integer,city_name text,customer_id bigint,first_name text,last_name text,item_id integer,item_name text,quantity bigint,payment_amount numeric,primary key (id));")

cur.close()
conn.close()
Leave a Comment