Cannot unpack Row instance
See original GitHub issueDescribe the bug
mypy
is complaining about unpacking Row
object, even though it works.
To Reproduce
test_table = Table(
"test_table",
metadata,
Column("i", UUID(as_uuid=True), nullable=False, primary_key=True),
Column("x", UUID(as_uuid=True), index=True),
Column("y", UUID(as_uuid=True), index=True),
)
query = test_table.select()
async with engine.connect() as connection:
result = await connection.execute(query)
row = result.fetchone()
if row:
my_dict = {**row}
Error
Argument after ** must be a mapping, not "Row"
Versions.
- OS: Linux Mint 19.3 Cinnamon
- Python: 3.7.10
- SQLAlchemy: 1.4.15
- Database: PostgreSQL
- DBAPI: asyncpg
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
TypeError: cannot unpack non-iterable NoneType object
You get this error when you perform a multiple assignment to None (which is of NoneType ). For instance: X_train, y_train, X_test, y_test...
Read more >TypeError cannot unpack non-iterable NoneType object
Hello,. The “TypeError: cannot unpack non-iterable NoneType object” error is raised when you try to unpack values from one that is equal to...
Read more >Typeerror: cannot unpack non-iterable nonetype object
This error was raised because we tried to unpack a None object. The simplest way around this is to not assign names.sort() as...
Read more >cannot unpack non-iterable NoneType object -returning a tuple
My understanding from other posts is that this occurs when trying to populate a tuple with only one value or the function doesn't...
Read more >Subset a Data Frame
For example, to subset the d data frame only by rows, the general form reduces to ... the missing data values are not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’d have to look into it, but off the top of my head I don’t know of a way to do it.
you need to turn on SQLALCHEMY_WARN_20 and also use Python -Walways or equivalent: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#migration-to-2-0-step-two-turn-on-removedin20warnings