I'm trying to build a new generic task for working with airtable. When trying to do it, building a separate package where I have the task
class ReadTable(Task):
def __init__(
self,
# table: str = None,
app: str = None,
formula: str = None,
api_key_name: str = "default_cred",
project_id: str = "some_id",
**kwargs: Any,
):
# self.table = table
<http://self.app|self.app> = app
self.formula = formula
self.api_key_name = api_key_name
self.project_id = project_id
super().__init__(**kwargs)
@defaults_from_attrs("app", "formula", "api_key_name", "project_id")
def run(
self,
table: str = None,
app: str = None,
formula: str = None,
api_key_name: str = None,
project_id: str = None,
) -> List[Any]:
# some code
return json.dumps(ret)
Trying to call this passing table as a
prefect.Parameter
it does not "resolve" to a string. However wrapping the call in a
readTable = ReadTable(app="some_app_space")
@task
def wrapper(table: str) -> List[Any]:
return readTable.run(table=table)
Then it works and
table
gets resolved correctly to its string value. Why is this? I've been looking allover for documentation.