Skip to content

Refactor existence-checking SQL to helper#32790

Merged
uranusjr merged 1 commit into
apache:mainfrom
astronomer:sql-exists-helper
Jul 26, 2023
Merged

Refactor existence-checking SQL to helper#32790
uranusjr merged 1 commit into
apache:mainfrom
astronomer:sql-exists-helper

Conversation

@uranusjr

Copy link
Copy Markdown
Member

I'm guessing this should be common enough to warrant a helper function. Some are identified and changed in this PR; I'm pretty sure there are more, but we can change them once by once when found.

I'm guessing this should be common enough to warrant a helper function.
Some are identified and changed in this PR; I'm pretty sure there are
more, but we can change them once by once when found.
@uranusjr
uranusjr requested review from XD-DENG, ashb and kaxil as code owners July 24, 2023 00:32
Comment thread airflow/utils/db.py
return session.scalar(count_stmt)


def exists_query(*where: ClauseElement, session: Session) -> bool:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def exists_query(*where: ClauseElement, session: Session) -> bool:
def exists_query(*where: ClauseElement, *, session: Session) -> bool:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can’t do this because where is already a star args. Bare * is (syntactically) a special case of *name and you can only have one star argument in the argument list.

@uranusjr
uranusjr merged commit 8809478 into apache:main Jul 26, 2023
@uranusjr
uranusjr deleted the sql-exists-helper branch July 26, 2023 01:48
@ephraimbuddy ephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:misc/internal Changelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants