A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/graphql-python/graphene-sqlalchemy/issues/293 below:

How can I roll back after a database error? · Issue #293 · graphql-python/graphene-sqlalchemy · GitHub

Hi, I am using this pattern: https://docs.graphene-python.org/projects/sqlalchemy/en/latest/tutorial/#defining-our-models

I noticed that when the database runs into an error, any further queries that want to use the same session are blocked.
E.g.:

  1. Have a postgres database with a table that has a date field and define queries.
  2. Now try to query the table and filter for the date.
  3. For the date, you accidentally enter an int (a year). You will run into an error like this:
sqlalchemy.exc.DataError: (psycopg2.errors.InvalidDatetimeFormat) invalid input syntax for type date: "2001"
  1. Now try a new query (correctly formed), you will get this error:
graphql.error.located_error.GraphQLLocatedError: (psycopg2.errors.InFailedSqlTransaction) current transaction is aborted, commands ignored until end of transaction block

The session is basically blocked and since the session management is hidden I dont know how to roll back the failed transaction from 3.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4