#PostgreSQL not inserting data

12 messages · Page 1 of 1 (latest)

broken root
#

So i have a bot that inserts data about files to a db that are uploaded to backblaze through it.
I use postgre to keep track.

im using psycopg2, and using the simple query:
CURSOR.execute('INSERT INTO lfs (file_id, file_name, user_id) VALUES (%s, %s, %s)', (file.id, ufile.filename, interaction.user.id))
This should be correct according to the psycopg2 docs.

When i run the command, all goes well. The file is uploaded, the link for the file is returned, and no errors are printed. However when i check the table its empty?
I tried running the query on railway, in the little tab for it, and it ran with no errors.

What is interesting though is that the ID, which is a serial autoincrement field, was 3, meaning something was caught by the db, but the table was still empty. nothing was ever in the table.

Im scratching my head at this.

Project ID: 45ce4783-9560-4cd6-9fe7-8982bd5ab434

undone harborBOT
#

Project ID: 45ce4783-9560-4cd6-9fe7-8982bd5ab434

broken root
#

oh forgot to add that when i ran the query on railways tab, it did insert it into the table

#

thats how i saw the serial ID and stuff

#

but before that i never caught anything

#

checked the logs and found this:

2023-05-30 11:31:27.347 UTC [430] LOG:  could not receive data from client: Connection reset by peer```
but i still dont understand
broken root
#

how do i mark as solved

peak ice
broken root
broken root
#

CURSOR.connection.commit() if you use psycopg2.