You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the docs it seems that we should be able to instantiate a Connection or a TableConnection and perform put_item, get_item, update_item and delete_item operations on them. However these all fail with the following error: Meta-table for '<table name>' not initialized
These operations work if we call describe_table first on the connection, like in the current integration tests.
examples to reproduce the issue:
table_name='pynamodb-ci-connection'conn=Connection(host=ddb_url)
# conn.describe_table(table_name) # bug: operations don't work without calling describe_table firstconn.put_item(
table_name,
'item1-hash',
attributes={'foo': {'S': 'bar'}},
) # pynamodb.exceptions.TableError: Meta-table for 'pynamodb-ci-connection' not initialized
table_name='pynamodb-ci-connection'conn=TableConnection(table_name=table, host=ddb_url)
# conn.describe_table() # bug: operations don't work without calling describe_table firstconn.put_item(
'item1-hash',
attributes={'foo': {'S': 'bar'}},
) # pynamodb.exceptions.TableError: Meta-table for 'pynamodb-ci-connection' not initialized
See the integration tests in the linked pull request for runnable versions of these examples.
Root cause
Itt seems that Connection.get_identifier_map relies on a MetaTable corresponding to the given table to extract information about it's hash and range keys.
Solution proposal
I propose to add an optional parameter, keyname_details, to all of the relevant operations and to Connection.get_identifier_map. If keyname_details is given use that, otherwise default to the current behaviour, that is try to fetch the key details from a MetaTable.
bpsoos
changed the title
low level api operations don't work without calling describe_table first
bug: low level api operations don't work without calling describe_table first
Aug 23, 2024
The issue
Based on the docs it seems that we should be able to instantiate a
Connection
or aTableConnection
and performput_item
,get_item
,update_item
anddelete_item
operations on them. However these all fail with the following error:Meta-table for '<table name>' not initialized
These operations work if we call
describe_table
first on the connection, like in the current integration tests.examples to reproduce the issue:
See the integration tests in the linked pull request for runnable versions of these examples.
Root cause
Itt seems that Connection.get_identifier_map relies on a MetaTable corresponding to the given table to extract information about it's hash and range keys.
Solution proposal
I propose to add an optional parameter,
keyname_details
, to all of the relevant operations and toConnection.get_identifier_map
. Ifkeyname_details
is given use that, otherwise default to the current behaviour, that is try to fetch the key details from a MetaTable.This could look something like the following:
Connection.get_identifier_map:
The text was updated successfully, but these errors were encountered: