Mark NS
04/05/2023, 8:42 AMreturn self.additional_properties[key]
KeyError: 0
I'm not very familiar with Pydantic - is there an obvious solution?Deceivious
04/05/2023, 9:30 AMadditional_keys
str
Mark NS
04/05/2023, 9:53 AMCompleted
function in states.py is called:
def Completed(cls: Type[State] = State, **kwargs) -> State:
"""Convenience function for creating `Completed` states.
Returns:
State: a Completed state
"""
return cls(type=StateType.COMPLETED, **kwargs)
where kwargs
is
kwargs = {dict: 1}
additional_keys = {list: 0} []
additional_properties = {dict: 0} {}
connection_configuration = {dict: 1} {'credentials'...
name = {str} 'Airtable'
source_definition_id = {str} '14c6e7ea-...'
source_id = {str} '6109..'
source_name = {str} 'Airtable'
workspace_id = {str} '52e...'
... and then we're into some Pydantic magic...
File "pydantic/main.py", line 339, in pydantic.main.BaseModel.__init__
File "pydantic/main.py", line 1076, in pydantic.main.validate_model
File "pydantic/fields.py", line 884, in pydantic.fields.ModelField.validate
File "pydantic/fields.py", line 1094, in pydantic.fields.ModelField._validate_singleton
File "pydantic/fields.py", line 892, in pydantic.fields.ModelField.validate
File "pydantic/fields.py", line 1151, in pydantic.fields.ModelField._apply_validators
File "pydantic/class_validators.py", line 337, in pydantic.class_validators._generic_validator_basic.lambda13
File "pydantic/main.py", line 716, in pydantic.main.BaseModel.validate
before the __getitem__
method is called.
File "/Users/markns/workspace/apollo/alakazam/airbyte_client/models/source_read.py", line 94, in __getitem__
return self.additional_properties[key]
KeyError: 0
No idea whats happening in the pydantic code to call the getitem, but I'll start digging through 🔍openapi-python-client
doesn't support being turned into a dict
In [6]: s = SourceRead("few", "fdsf", "fdsf", {'user': 'charles'}, "fdsfsd", "fdsfds")
s
Out[6]: SourceRead(source_definition_id='few', source_id='fdsf', workspace_id='fdsf', connection_configuration={'user': 'charles'}, name='fdsfsd', source_name='fdsfds', icon=<airbyte_client.types.Unset object at 0x102eaa890>, additional_properties={})
In [7]: dict(s)
Traceback (most recent call last):
File "/Users/markns/Library/Caches/pypoetry/virtualenvs/alakazam-vR_Oc5bv-py3.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3460, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-7-592f42a061b0>", line 1, in <module>
dict(s)
File "/Users/markns/workspace/apollo/alakazam/airbyte_client/models/source_read.py", line 94, in __getitem__
return self.additional_properties[key]
KeyError: 0