We continue our series on creating a Telegram bot in Python. In this section, we'll connect to the database—switching from Excel to SQLite via SQLAlchemy ORM.
This isn't just a tutorial: by the end, we'll have a ready-made foundation for an API, admin panel, and AI-powered ticket processing.
🔍 What we'll cover:
— Why a Telegram bot needs a database
— Why SQLite is convenient for getting started
— How to connect SQLAlchemy ORM
— How to describe the Lead model
— How to save and read requests
— How to restrict access to /leads to the bot owner only
⚙️ Stack:
Python · python-telegram-bot · SQLite · SQLAlchemy · .env · Telegram Bot API
📌 Timestamps:
00:00 — Introduction
00:30 — Why Excel is no longer enough
01:30 — Why we choose SQLite
02:20 — Connecting SQLAlchemy
03:40 — Creating the Lead model
04:40 — Creating a repository for requests
05:50 — Initializing the database in bot.py
07:00 — Converting lead_manager.py to ORM
08:10 — Adding the /leads command
09:20 — Testing in Telegram
10:40 — What to do next
🔗 Other parts of the series:
▶️ Part 1 — Telegram bot with an AI agent: • Как создать Telegram-бота с ИИ за 10 минут...
▶️ Part 3 — FastAPI + Tailwind + Chart.js Admin Panel: • Админ-панель( mini crm) для Telegram бота ...
📂 Project source code: https://t.me/codautomat
👉 Subscribe to "Code on Automat" — real projects, automation, and development in simple language.
#python #telegrambot #sqlalchemy #sqlite #development #programming #vibecoding #ai #codeonautomat #orm #database #pythonprojects
En esta página del sitio puede ver el video en línea Database for a Telegram Bot in Python | SQLite + SQLAlchemy ORM | Part 2 de Duración hora minuto segunda en buena calidad , que subió el usuario Code on Autopilot 15 abril 2026, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 55 veces y le gustó 0 a los espectadores. Disfruta viendo!