Code Monkey home page Code Monkey logo

Comments (8)

aritra24 avatar aritra24 commented on July 2, 2024 1

Hmm, thanks. I'll try reproducing it later today or tomorrow. Will assign it to myself for now.

from airflow.

boring-cyborg avatar boring-cyborg commented on July 2, 2024

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

from airflow.

aritra24 avatar aritra24 commented on July 2, 2024

@MialLewis could you share a complete example, ie a complete dag that could be used to replicate the behaviour and any other configs/etc?

from airflow.

MialLewis avatar MialLewis commented on July 2, 2024

Here is a minimal dag that reproduces the issue:

from airflow import DAG
from airflow.utils.dates import days_ago

default_args = {
    'owner': 'airflow',
}

with DAG(
    dag_id='issue_dag',
    default_args=default_args,
    start_date=days_ago(2),
    tags=['issue'],
) as dag:

    @dag.task
    def error_fn():
        import pandas as pd
        output_df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
        engine = _get_engine_from_conn(conn_id='MariaDB')
        output_df.to_sql(name='test_table', con=engine, schema='temp', if_exists='replace')

    def _get_engine_from_conn(conn_id):
        from airflow.providers.mysql.hooks.mysql import MySqlHook as hook
        db_hook = hook(mysql_conn_id=conn_id)
        engine = db_hook.get_sqlalchemy_engine()
        return engine

error_task = error_fn()

The connection I am using to a simple MariaDB of the latest version:
image

from airflow.

aritra24 avatar aritra24 commented on July 2, 2024

I tried reproducing it, I see that the issue is because of the values in extra, ie the {}. Removing them removes the extra field from the engine and doesn't cause the issue. Though the existence of the extra field is odd to be because to my knowledge mysql doesn't accept it... 🤔 @potiuk would you know if that should probably not exist in the mysql connection type? Or maybe it should be encoded some other way?

Also @MialLewis to fix your issue you can just remove the {} from extras and you should be good.

from airflow.

MialLewis avatar MialLewis commented on July 2, 2024

I can’t remove the ‘{}’, it gets put there by default when the extra field is left empty.

I mentioned this in the issue post:

“Looking at previous versions of airflow, the default value in the extras field in a connection appears to have gone from None to {}.”

Thanks for taking the time to look into this.

from airflow.

aritra24 avatar aritra24 commented on July 2, 2024

from airflow.

github-actions avatar github-actions commented on July 2, 2024

This issue has been automatically marked as stale because it has been open for 14 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.

from airflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.