Python Forum
Get last row of SQL database and update
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get last row of SQL database and update
#1
First time working with a SQL database...

I have the following database:

+------------+-------------------+--------------+--------------+-----------------+--------------+------------+
| meeting_id | user_id           | meeting_date | meeting_time | meeting_name    | participants | message_id |
+------------+-------------------+--------------+--------------+-----------------+--------------+------------+
| 1          | 95707125543604224 | 10/12/2021   | 8:00         | Interivew       |              | 8953470    |
+------------+-------------------+--------------+--------------+-----------------+--------------+------------+
| 2          | 95707125543604224 | 10/14/2021   | 12:00        | 1 on 1 w/ John  |              | 5270659    |
+------------+-------------------+--------------+--------------+-----------------+--------------+------------+
| 3          | 75123547643604126 | 12/25/2021   | 13:30        | Christmas Lunch |              | 5468943    |
+------------+-------------------+--------------+--------------+-----------------+--------------+------------+
| 4          | 75123547643604126 | 12/28/2021   | 11:00        | Staff Meeting   |              |            |
+------------+-------------------+--------------+--------------+-----------------+--------------+------------+
I need to update the message_id and participants field once users start accepting the meeting invite. I'm using the following code to grab the last row based on the unique, sequential meeting_id field:

last_meeting = db.execute("SELECT TOP 1 * FROM meetingData ORDER BY meeting_id DESC")
I'm grabbing the last row because this will be executed just after the meeting row is created in the database and passed to another function to modify. The output of last_meeting is:

Output:
<aiosqlite.context.Result object at 0x0000021F037C6F40>
My question is how do I use this information now to update the fields for this row?

Thanks in advanced.
Reply


Messages In This Thread
Get last row of SQL database and update - by Turtle - Oct-14-2021, 12:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Python + Google Sheet | Best way to update specific cells in a single Update()? Vokofe 1 2,701 Dec-16-2020, 05:26 AM
Last Post: Vokofe
Photo Update database in tkinter shahulvk 3 3,173 Oct-24-2020, 04:48 PM
Last Post: shahulvk
  How to update sql database from csv Prince_Bhatia 0 2,593 Feb-09-2019, 09:15 PM
Last Post: Prince_Bhatia
  add content of database to text widgte with update atlass218 1 2,593 Jan-06-2019, 02:13 AM
Last Post: woooee
  How to update only two colums in database from csv without touching data in other col Prince_Bhatia 0 2,285 Aug-21-2018, 09:13 AM
Last Post: Prince_Bhatia
  problem with select and update the data into the database chris0147 1 3,197 Aug-18-2017, 09:38 PM
Last Post: chris0147
  Search the data to update in a database chris0147 7 6,756 Oct-27-2016, 03:16 PM
Last Post: Ofnuts
  update the data into the database chris0147 3 6,243 Oct-19-2016, 12:12 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020