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

py files doesn't have to be checked is_zipfiles in process_files #21538

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ https://developers.google.com/style/inclusive-documentation

-->

### You can't name zip files as ending with .py for DAGs

It was previously possible to load any files as zip files in the DAGs folder via `zipfile.is_zipfile`.

Now .py (extension) files are going to be loaded as modules without checking whether it is zipfile. (Less IO)
If .py file in the DAGs folder were a zip compressed file, processing it would be failed with exception.
sungpeo marked this conversation as resolved.
Show resolved Hide resolved

### You have to use `postgresql://` instead of `postgres://` in `sql_alchemy_conn` for SQLAlchemy 1.4.0+

When you use SQLAlchemy 1.4.0+, you need ot use `postgresql://` as the database in the `sql_alchemy_conn`.
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/dagbag.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def process_file(self, filepath, only_if_updated=True, safe_mode=True):
self.log.exception(e)
return []

if not zipfile.is_zipfile(filepath):
if filepath.endswith(".py") or not zipfile.is_zipfile(filepath):
mods = self._load_modules_from_file(filepath, safe_mode)
else:
mods = self._load_modules_from_zip(filepath, safe_mode)
Expand Down