Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next_ds changed to proxy and it cannot be used in ds_add macro function #19241

Closed
1 of 2 tasks
ShaharPotash1 opened this issue Oct 27, 2021 · 3 comments · Fixed by #19592
Closed
1 of 2 tasks

next_ds changed to proxy and it cannot be used in ds_add macro function #19241

ShaharPotash1 opened this issue Oct 27, 2021 · 3 comments · Fixed by #19592
Labels
affected_version:2.2 Issues Reported for 2.2 area:core good first issue kind:bug This is a clearly a bug

Comments

@ShaharPotash1
Copy link
Contributor

Apache Airflow version

2.2.0 (latest released)

Operating System

Ubuntu

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

What happened

Tried to use this this code:
some_variable='{{macros.ds_format(macros.ds_add(next_ds, ' '(ti.start_date - ti.execution_date).days), ' '"%Y-%m-%d", "%Y-%m-%d 21:00:00")}}')
but got this error:
strptime() argument 1 must be str, not Proxy
because the next_ds variable changed to proxy.

What you expected to happen

No response

How to reproduce

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@ShaharPotash1 ShaharPotash1 added area:core kind:bug This is a clearly a bug labels Oct 27, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 27, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@ShaharPotash1
Copy link
Contributor Author

@potiuk

@uranusjr
Copy link
Member

I think we need to explicitly cast inputs with str() in airflow/macros/__init__.py. For example:

def ds_add(ds, days):
    ds = datetime.strptime(str(ds), '%Y-%m-%d')  # Note the extra str() call.
    ...

Fancy a pull request fixing this? Some tests to make sure this doesn't regress would probably be needed.

ShaharPotash1 added a commit to ShaharPotash1/airflow that referenced this issue Oct 27, 2021
…t Proxy)

As already written in this issue apache#19241 strptime function required string, but got proxy if the variables ds/next_ds (the types of these variables changed on version 2.2.0) sent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:2.2 Issues Reported for 2.2 area:core good first issue kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants