serial
02/22/2024, 5:51 AMfrom prefect.blocks.core import Block, SecretDict
class Custom(Block):
my_secret_dict: SecretDict
my_dict_with_int_keys={
0: 'field0',
2: 'field2'
}
print(my_dict_with_int_keys)
# prints: {0: 'field0', 2: 'field2'}
my_block = Custom(my_secret_dict=my_dict_with_int_keys)
my_block.save(name='blockname')
my_new_block = Custom.load('blockname')
print(my_new_block.my_secret_dict.get_secret_value())
# prints: {'0': 'field0', '2': 'field2'}
Is it normal or i have to use something particular ?
Thank youserial
02/24/2024, 10:29 AMserial
02/27/2024, 8:44 AMJeff Hale
02/27/2024, 4:48 PMdict()
method, you will get back the obfuscated values:
print(my_new_block.my_secret_dict.dict())
outputs;
{'0': '**********', '2': '**********'}
Jeff Hale
02/27/2024, 4:48 PMdef get_secret_value(self) -> Dict[str, Any]:
return self._secret_value
def dict(self) -> Dict:
return {key: "**********" for key in self.get_secret_value().keys()}
serial
02/27/2024, 6:31 PM