Creation of my metadata is failing ``` met...
# ask-community
l
Creation of my metadata is failing
Copy code
metadata = {
            "num_failed_chats": <http://MetadataValue.int|MetadataValue.int>(len(failed_chat_ids)),
            "error_codes": MetadataValue.table(
                records=[TableRecord(code=int(code), count=int(count))
                         for code, count in count_codes.items()],
                schema=TableSchema(
                    columns=[
                        TableColumn(name="code", type="int"),
                        TableColumn(name="count", type="int")
                    ]
                )
            )
        }
is returning
Copy code
TypeError: TableRecord.__new__() got an unexpected keyword argument 'code'
🤖 1
z
Looking at the source for
TableRecord
it looks like it only takes a
data
parameter which is supposed to be a dict - you might try something like
TableRecord(data={"code": int(code), "count": int(count)})
l
Thanks for peeping that,
Works +1
🎉 1