Pavel_Duron
73bf3af7a4
All checks were successful
continuous-integration/drone/push Build is passing
61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
from sqlalchemy import create_engine, MetaData, Table, Integer, String, BIGINT, \
|
|
Column, DateTime, ForeignKey, Numeric
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy.orm import sessionmaker
|
|
from sqlalchemy import select, update
|
|
|
|
engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
|
|
Session = sessionmaker(bind=engine)
|
|
session = Session()
|
|
|
|
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
|
|
class user(Base):
|
|
__tablename__ = 'users'
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
user_id = Column(Integer)
|
|
user_fullname = Column(String)
|
|
dick_size = (Column(Integer))
|
|
datetimes = (Column(DateTime))
|
|
chat_id = Column(BIGINT)
|
|
|
|
def __init__(self, user_id, user_fullname, dick_size, datetimes, chat_id):
|
|
self.user_id = user_id
|
|
self.user_fullname = user_fullname
|
|
self.dick_size = dick_size
|
|
self.datetimes = datetimes
|
|
self.chat_id = chat_id
|
|
|
|
print(user.chat_id)
|
|
|
|
# session.close()
|
|
# top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == user.chat_id).limit(10).all()
|
|
# print(top)
|
|
|
|
|
|
#Base.metadata.create_all(engine)
|
|
|
|
# int_table = user(user_id = 12345678, user_fullname = 'test', dick_size = 10) #импортирую юзер из sqdb
|
|
# session.add(int_table)
|
|
# session.commit()
|
|
# select user_id, name from employees limit 10
|
|
|
|
# def adding():
|
|
|
|
# session.add()
|
|
# session.commit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|