LLL
LLL

Reputation: 289

Unsupported operation RETURN_GENERATOR on select()

I'm new at ponyorm and was trying to learn how to use ponyorm. I have the following script

from pony.orm import Database,PrimaryKey,select,Required

db = Database()
db.bind(
    provider='postgres', 
    user='postgres', 
    password='root', 
    host='localhost', 
    database='test')

class TestTable(db.Entity):
    _table_ = "testTable"
    columnOne = PrimaryKey(int, column="columnOne")
    columnTwo = Required(str, column="columnTwo")

db.generate_mapping(create_tables=True)

result = select(row for row in TestTable)

I was trying to use the select() method. It throws the following error

Traceback (most recent call last):
  File "d:\Git Project Folder\test\database.py", line 18, in <module>
    result = select(r for r in TestTable)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Git Project Folder\test\env\Lib\site-packages\pony\orm\core.py", line 5560, in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Git Project Folder\test\env\Lib\site-packages\pony\orm\core.py", line 5546, in make_query
    tree, external_names, cells = decompile(gen)
                                  ^^^^^^^^^^^^^^
  File "D:\Git Project Folder\test\env\Lib\site-packages\pony\orm\decompiling.py", line 38, in decompile
    decompiler = Decompiler(codeobject)
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Git Project Folder\test\env\Lib\site-packages\pony\orm\decompiling.py", line 156, in __init__
    decompiler.decompile()
  File "D:\Git Project Folder\test\env\Lib\site-packages\pony\orm\decompiling.py", line 256, in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
  File "D:\Git Project Folder\test\env\Lib\site-packages\pony\utils\utils.py", line 99, in throw
    raise exc
pony.orm.decompiling.DecompileError: Unsupported operation: RETURN_GENERATOR 

What is wrong with my code ? i was following the example at https://docs.ponyorm.org/queries.html

Upvotes: 3

Views: 632

Answers (0)

Related Questions