Skip to content

Guard type aliases and remove redundant imports in the postgres hook - #61554

Merged
shahar1 merged 1 commit into
apache:mainfrom
Dev-iL:2602/postgres_types
Feb 7, 2026
Merged

Guard type aliases and remove redundant imports in the postgres hook#61554
shahar1 merged 1 commit into
apache:mainfrom
Dev-iL:2602/postgres_types

Conversation

@Dev-iL

Copy link
Copy Markdown
Collaborator

This attempts to fix the below issue with doc generation in the google provider observed in CI that happens while importing the postgres provider.

Traceback (mostrecentcalllast):
File"/usr/python/lib/python3.10/site-packages/sphinx/ext/autodoc/importer.py", line143, inimport_modulereturnimportlib.import_module(modname)
File"/usr/python/lib/python3.10/importlib/__init__.py", line126, inimport_modulereturn_bootstrap._gcd_import(name, package, level)
File"<frozen importlib._bootstrap>", line1050, in_gcd_importFile"<frozen importlib._bootstrap>", line1027, in_find_and_loadFile"<frozen importlib._bootstrap>", line1006, in_find_and_load_unlockedFile"<frozen importlib._bootstrap>", line688, in_load_unlockedFile"<frozen importlib._bootstrap_external>", line883, inexec_moduleFile"<frozen importlib._bootstrap>", line241, in_call_with_frames_removedFile"/opt/airflow/providers/google/src/airflow/providers/google/cloud/transfers/bigquery_to_postgres.py", line31, in<module>fromairflow.providers.postgres.hooks.postgresimportPostgresHookFile"/opt/airflow/providers/postgres/src/airflow/providers/postgres/hooks/postgres.py", line68, in<module>CursorType: TypeAlias=DictCursor|RealDictCursor|NamedTupleCursorTypeError: unsupportedoperand type(s) for|: 'DictCursor'and'RealDictCursor'

The fix is moving the two TypeAlias definitions into the existing TYPE_CHECKING block. Also, imports were cleaned up a bit.

related: #61532


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@Dev-iL
Dev-iLforce-pushed the 2602/postgres_types branch from 70bd604 to de2d4a0CompareFebruary 6, 2026 21:01

@bugraoz93bugraoz93 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CI looks green, thanks @Dev-iL !

@shahar1shahar1 changed the title Guard type aliases & remove redundant imports in the postgres hookGuard type aliases and remove redundant imports in the postgres hookFeb 7, 2026
@shahar1
shahar1 merged commit 19c17c4 into apache:mainFeb 7, 2026
90 checks passed
jhgoebbert pushed a commit to jhgoebbert/airflow_Owen-CH-Leung that referenced this pull request Feb 8, 2026
AkshayArali pushed a commit to AkshayArali/airflow_630 that referenced this pull request Feb 27, 2026
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Mar 4, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Dev-iL@bugraoz93@shahar1