async def purchasevpn(callback_query: types.CallbackQuery):
numbers = callback_query.message.text
DELETE FROM table_name;
import psycopg2
conn = psycopg2.connect("host=localhost dbname=postgres user=postgres password=1111111")
cur = conn.cursor()
with open('file.csv', 'r', encoding="utf-8") as f:
next(f)
cur.copy_from(f, 'table_name', sep=',')
conn.commit()
async def minus_quantity(self, telegram_id):
sql = "UPDATE users SET quantity=quantity-1 WHERE telegram_id=$1"
return await self.execute(sql, telegram_id)
@dp.message_handler(Command("test"))
async def bot_echo(message: types.Message):
await message.answer("текст")
telegram_id = message.from_user.id
quantity = await db.quantity(telegram_id)
print(quantity)
await db.minus_quantity(telegram_id)
await message.answer(f"Число попыток: {quantity}")
print(quantity)