Битый час не могу для цикла вытащить столбик user_id из таблицы test
import sqlite3
from aiogram import types, Bot, Dispatcher, executor, types
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.builtin import CommandStart
from aiogram.contrib.fsm_storage.memory import MemoryStorage
con = sqlite3.connect('database.db')
cursor = con.cursor()
def db_table_val(user_id: int, user_name: str, user_surname: str, username: str):
cursor.execute('INSERT INTO test (user_id, user_name, user_surname, username) VALUES (?, ?, ?, ?)', (user_id, user_name,user_surname, username))
con.commit()
async def on_startup():
cursor.execute('SELECT user_id FROM test')
arr = []
arr = cursor.fetchall()
for user_id in arr:
await bot.send_message(chat_id=user_id, text="Бот запущен!")
await asyncio.sleep(1)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates = True, on_startup = on_startup)