Skip to content

Incorrect check of query result - #4

Closed
dcepeda31415 wants to merge 1 commit into
N4si:mainfrom
dcepeda31415:patch-1
Closed

Incorrect check of query result#4
dcepeda31415 wants to merge 1 commit into
N4si:mainfrom
dcepeda31415:patch-1

Conversation

@dcepeda31415

Copy link
Copy Markdown

the execute method of a cursor object in psycopg2 does not return any value and so it still runs fine but it still does not return a result that indicates whether the query was successful or not so setting it equal to res is pointless since it only executes the SQL command without providing result.
To determine if the query returned any result, you need to use the fetchone() or fetchall() methods after execute.

@dcepeda31415 dcepeda31415 closed this by deleting the head repository Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant