简体   繁体   English

Heroku 上的 Python 机器人:Integer 超出范围(SQLAlchemy)

[英]Python bot on Heroku: Integer out of range (SQLAlchemy)

I'm using a Python bot template, it can be found here: https://github.com/diviiac/IAC2.0/我正在使用 Python 机器人模板,它可以在这里找到: https://github.com/diviiac/IAC2.0/

For SQLALCHEMY database, I am using Elephant SQL and app is hosted on Heroku.对于 SQLALCHEMY 数据库,我使用的是 Elephant SQL,应用程序托管在 Heroku 上。

When I try to run the Telegram bot, the following error appears on Heroku:当我尝试运行 Telegram 机器人时,Heroku 上出现以下错误:

 2021-12-09T20:50:06.203420+00:00 app[worker.1]: sqlalchemy.exc.DataError: (psycopg2.errors.NumericValueOutOfRange) integer out of range

2021-12-09T20:50:06.203421+00:00 app[worker.1]: 

2021-12-09T20:50:06.203421+00:00 app[worker.1]: [SQL: INSERT INTO users (user_id, username) VALUES (%(user_id)s, %(username)s)]

2021-12-09T20:50:06.203421+00:00 app[worker.1]: [parameters: {'user_id': 5077702275, 'username': 'Lena_MilizeBot'}]

Can someone point out the mistake?有人可以指出错误吗?

Had to replace int with BigInteger and it worked.必须用BigInteger替换 int 并且它有效。 As rightly pointed by out Adrian in the comments, we need to use "Bigint" for Postgresql.正如 Adrian 在评论中正确指出的那样,我们需要对 Postgresql 使用“Bigint”。 However, for SQLALCHEMY, value is BigInteger.但是,对于 SQLALCHEMY,值为 BigInteger。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM