mcfunley / pugsql

A HugSQL-inspired database library for Python
https://pugsql.org
Apache License 2.0
673 stars 22 forks source link

AttributeError: 'tuple' object has no attribute 'keys' #38

Closed Yeganloo closed 3 years ago

Yeganloo commented 3 years ago

Trying to run following SQL statement cause this error:

AttributeError: 'tuple' object has no attribute 'keys'

SQL:

-- :name create_item :scalar
insert into item(title, type, user, status)
select :title, t.id, u.id, :status
    from user as u
    inner join item_type as t on u.user_name = :user and d.type = :type
RETURNING id
Yeganloo commented 3 years ago

Problem was in the way i call my query! It solved by sending named parameters!

mcfunley commented 3 years ago

👍

We should see if we can give a better error in this case, I'll ticket separately