Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help3403


This forum is provided to promote discussion amongst students enrolled in Agile Web Development (CITS3403).
 
Options:
RSS cloud
Jump to:

Error printing column values from table query

3 of 419 articles shown, currently no other people reading this forum.
photo
From: ANONYMOUS
Date: Mon 25th May 2020, 2:06pm
Actions: 
        Login-to-reply

 

When I try to print values from a column "s" in a table "statement" by iterating over a Session.Query object returned by Session.query(statement), I get the following error:

"(sqlite3.IntegrityError) UNIQUE constraint failed: statement.s
 [SQL: INSERT INTO statement (s) VALUES (?)]
 [parameters: ('Test statement.',)]
 (Background on this error at: http://sqlalche.me/e/gkpj)"

Does anyone know what's causing this error?

Error printing column values from table query

photo
From: Haolin W.
Date: Mon 25th May 2020, 3:49pm
Actions: 
        Login-to-reply

 

Why are you trying to iterate over the query object? What exactly are you trying to do?

ANONYMOUS wrote:

> When I try to print values from a column "s" in a table "statement" by iterating over a Session.Query object returned by Session.query(statement), I get the following error:
> 
> "(sqlite3.IntegrityError) UNIQUE constraint failed: statement.s
>  [SQL: INSERT INTO statement (s) VALUES (?)]
>  [parameters: ('Test statement.',)]
>  (Background on this error at: https://sqlalche.me/e/gkpj)"
> 
> Does anyone know what's causing this error?

Error printing column values from table query

photo
From: Timothy F.
Date: Mon 25th May 2020, 5:02pm
Actions: 
        Login-to-reply

 

ANONYMOUS wrote:

> When I try to print values from a column "s" in a table "statement" by iterating over a Session.Query object returned by Session.query(statement), I get the following 
error:
> 
> "(sqlite3.IntegrityError) UNIQUE constraint failed: statement.s
>  [SQL: INSERT INTO statement (s) VALUES (?)]
>  [parameters: ('Test statement.',)]
>  (Background on this error at: http://sqlalche.me/e/gkpj)"
> 
> Does anyone know what's causing this error?

Normally this hapens when you insert something into the database when it's primary key already exists.

Happens a lot when your tests crash and teardown doesn't happen.
This Page


Program written by: [email protected]
Feedback welcome
Last modified: 11:27am Sep 21 2020