[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Template for Operator' Json Argument

I think you need to convert any non-str type into a string to render it in
the template, i.e., just str(foo).

But in your template, if I understand correctly that you're building a JSON
object as a string you could render that particular field without quotes
wrapping it, so a JSON parser would detect it as an int, not a str.  Does
that make sense?

Can you share your code?


On Sat, May 5, 2018 at 4:42 AM ramandumcs@xxxxxxxxx <ramandumcs@xxxxxxxxx>

> Hi All,
> We have implemented a custom operator which is derived from baseOperator.
> Custom operator takes a JSON argument. Some fields of this Json are string
> and others are integer. We need to templatised the string fields only and
> not integer. But on doing this we are getting the error
> airflow.exceptions.AirflowException: Type '<type 'int'>' used for parameter
> 'json[number]' is not supported for templating.
> So is this possible to have both string and integer in templatised field.
> Thanks,
> Raman Gupta
*Taylor Edmiston*
Blog <> | Stack Overflow CV
<> | LinkedIn
<> | AngelList