From 7d00f9d22fdf5aceeab11bbfbc1877f3713c629e Mon Sep 17 00:00:00 2001 From: Pavel_Duron Date: Sat, 12 Nov 2022 23:18:46 +1000 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=20=D1=8B=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D0=B1=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 4 ++-- sqdb.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 73fe1e3..41dd112 100644 --- a/bot.py +++ b/bot.py @@ -74,10 +74,10 @@ async def ident(message: types.Message): session.add(int_table) session.commit() #обновление - # dick_update = session.query(user).filter_by(user.user_id == message.from_user.id).update({'dick_size': user.dick_size + numb}) + # dick_update = session.query(user).filter_by(user.user_id = message.from_user.id).update({'dick_size': user.dick_size + numb}) # session.add(dick_update) # session.commit() - last_size = session.query(user).filter_by(user_id = message.from_user.id).first() + last_size = session.query(user).filter_by(user_id = message.from_user.id).select_from(dick_size).one() await bot.send_message(message.chat.id, f'{message.from_user.full_name}, ваш писюн {size_change}\ Теперь он равен {last_size} пока еще хуй знает сколько сантиметров ') diff --git a/sqdb.py b/sqdb.py index 72cdb1d..f036ad9 100644 --- a/sqdb.py +++ b/sqdb.py @@ -2,6 +2,7 @@ from sqlalchemy import create_engine, MetaData, Table, Integer, String, \ 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) @@ -20,12 +21,17 @@ class user(Base): user_id = Column(Integer) user_fullname = Column(String) dick_size = (Column(Integer)) + + # 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():