I have the following code in python with connection to SQLServer database made in ubuntu (it is a bot for telegram):
import pymssql
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
server = '10.248.205.209'
user = 'esolis'
password = 'secret'
database = 'pythonstorage'
conecction = pymssql.connetion(server, user, password, database)
cur = connection.cursor()
sql = ' SELECT id,servicio FROM logdaga'
cur.execute(sql)
def start(bot, update):
update.message.reply_text('Bienvenido a BotSQL, ¿En que te puedo ayudar?, Para ver mis comandos usa: /help')
def tables(bot, update):
for row in cur.fetchall():
resultado = row[0], row[1]
update.message.reply_text(resultado)
This table logdaga
has 10 records but ......
As a result of executing the /tables
command in the telegram bot, I get the following result:
As you can see in the image, only one record appears instead of the 10 records it contains, I would like to know what I am doing wrong: (.
Beforehand I thank you for your help.