I have no problem using psycopg2 with MWAA.
in my requirements i just have psycopg2-binary not psycopg2.
Here is a dag i like to use to list all the pip packages installed on my MWAA airflow environement:
import os
from datetime import timedelta
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.utils.dates import days_ago
DAG_ID = os.path.basename(__file__).replace('.py', '')
DEFAULT_ARGS = {
'owner': 'Louis',
'depends_on_past': False,
'email_on_failure': False,
'email_on_retry': False
}
with DAG(
dag_id=DAG_ID,
default_args=DEFAULT_ARGS,
description='Print all installed Python packages',
dagrun_timeout=timedelta(hours=2),
start_date=days_ago(1),
schedule_interval=None,
tags=['bash']
) as dag:
list_python_packages_operator = BashOperator(
task_id='list_python_packages',
bash_command='python3 -m pip list'
)
list_python_packages_operator
Hope it helps debugging your issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…