How to find the user_id in the Telegram Bot by pressing the button(InlineKeyboard)?

Good afternoon. I have the bot has inline keyboard, by pressing on button there is a write/read values from the database.
To read/write the data I need to know user_id of the user.
How to get user_id user press the button?

Now I take a step back user_id and store it in a variable, but now when my bot uses several people - sometimes this variable someone overwrites and the person issued the data from the database of a different user...
In General, how to get user_id of the user who clicked the button inline?

Here in this code, for example:
@bot.callback_query_handler(func=lambda call: call.data in ['locs0', 'locs1', 'locs2'])
 def check_weather(c):
 global latitude, longitude
 if c.data == 'locs0':
 values = ({'user_id': idToSave})
 cursor.execute("SELECT latitude, longitude FROM locations WHERE user_id = %(user_id)s", values)
 lalo = cursor.fetchall()
 latitude = lalo[0][0]
 longitude = lalo[0][1]
 nextstep_check_weather(c)

learn user_id? What can replace the variable idToSave?
April 3rd 20 at 18:54
1 answer
April 3rd 20 at 18:56
In the object CallbackQuery is the "from" field is an object of the Userthat initiated the callback.
Have User a is id - this is your chat_id.
It is necessary to use:
from.chad.id ?

Unfortunately it gives an error syntax:
values = ({'user_id': from.chat.id}) - terrill.Hartmann commented on April 3rd 20 at 18:59
@gene.Smith, I don't know Python. And even your code is not fully see. You will need to figure out how to get the value from the object.

Most likely:
values = ({'user_id': c.from.id}) - Carson commented on April 3rd 20 at 19:02
Unfortunately does not work.
5dfdf49dbac1f947163838.png - terrill.Hartmann commented on April 3rd 20 at 19:05
@gene.Smith, c.message.from_user.id - margaret_Gaylord75 commented on April 3rd 20 at 19:08
@Hassa, tried - does not work.
Somehow, the issue is NOT THE user_id which is the user.
What is interesting is that the user_id is not in the chat at all(I looked at the database, these users were not) - terrill.Hartmann commented on April 3rd 20 at 19:11

Find more questions by tags PythonBotsTelegram