Python CLI syncdb command throws a TypeError

Jump to solution
LoganBrewer1
Community Explorer

I'm using an aws postgres database and get this error when I try running the syncdb command. 

 

root@c89f2222f95d:/app# dap syncdb --table accounts
2023-12-06 20:06:03,485 - ERROR - missing context for evaluating type: ForwardRef('JsonType')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/dap/__main__.py", line 133, in console_entry
    main()
  File "/usr/local/lib/python3.10/site-packages/dap/__main__.py", line 125, in main
    asyncio.run(dapCommand.execute(args))
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/dap/commands/commands.py", line 31, in execute
    executed = await super().execute(args)
  File "/usr/local/lib/python3.10/site-packages/dap/commands/base.py", line 49, in execute
    if await subcommand.execute(args):
  File "/usr/local/lib/python3.10/site-packages/dap/commands/base.py", line 45, in execute
    await self._execute_impl(args)
  File "/usr/local/lib/python3.10/site-packages/dap/commands/syncdb_command.py", line 42, in _execute_impl
    await sync_db(
  File "/usr/local/lib/python3.10/site-packages/dap/actions/sync_db.py", line 16, in sync_db
    await SQLReplicator(session, db_connection).synchronize(
  File "/usr/local/lib/python3.10/site-packages/dap/replicator/sql.py", line 98, in synchronize
    since = await metatable_manager.get_timestamp()
  File "/usr/local/lib/python3.10/site-packages/dap/integration/base_meta_table.py", line 135, in get_timestamp
    return await self.get_timestamp_impl(
  File "/usr/local/lib/python3.10/site-packages/dap/plugins/postgres/meta_table.py", line 60, in get_timestamp_impl
    metatable_record = await MetatableRecord.load(
  File "/usr/local/lib/python3.10/site-packages/dap/integration/base_meta_table.py", line 90, in load
    typing.cast(Schema, json_to_object(Schema, schema_description)),
  File "/usr/local/lib/python3.10/site-packages/strong_typing/serialization.py", line 60, in json_to_object
    parser = create_deserializer(typ, context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 791, in create_deserializer
    return _get_deserializer(typ, context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 837, in _get_deserializer
    deserializer.build(context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 238, in build
    self.value_parser = _get_deserializer(self.value_type, context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 837, in _get_deserializer
    deserializer.build(context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 349, in build
    self.member_parsers = tuple(
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 350, in <genexpr>
    _get_deserializer(member_type, context) for member_type in self.member_types
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 837, in _get_deserializer
    deserializer.build(context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 238, in build
    self.value_parser = _get_deserializer(self.value_type, context)
  File "/usr/local/lib/python3.10/site-packages/strong_typing/deserializer.py", line 804, in _get_deserializer
    raise TypeError(f"missing context for evaluating type: {typ}")
TypeError: missing context for evaluating type: ForwardRef('JsonType')

 

 
All other commands work (initdb, dropdb, incremental), and I made sure the database user has access to delete/update/insert. The same error occurs regardless of which table I try syncing. Any help would be greatly appreciated! Thank you. 

Labels (4)
1 Solution

You need to pin one of the dependencies to an earlier version:

python3 -m pip install json_strong_typing==0.2.9

 

View solution in original post