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

Import CSV File Into PosgreSQL Table. Error: password authentication failed #4285

Closed
3 tasks done
oxystin opened this issue Jan 25, 2018 · 3 comments · Fixed by #4562
Closed
3 tasks done

Import CSV File Into PosgreSQL Table. Error: password authentication failed #4285

oxystin opened this issue Jan 25, 2018 · 3 comments · Fixed by #4562

Comments

@oxystin
Copy link

oxystin commented Jan 25, 2018

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.22.1

Expected results

Import CSV File Into PosgreSQL Table

Actual results

CSV file import error:
screen shot 2018-01-25 at 06 47 42

Postgres Log:
screen shot 2018-01-25 at 06 52 50

This can be corrected if you change the configuration file pg_hba.conf

host all all 172.18.0.0/16 trust

But this is not safe.

@Him121
Copy link

Him121 commented Mar 3, 2018

Hi Was any alternative found for this issue?
The connection to PostgreSQL seems fine, but when we try to upload CSV file we are getting above error.

Thanks, cheers.

@ktravis
Copy link
Contributor

ktravis commented Mar 6, 2018

I was experiencing the same issue and did some digging. It seems that as of #4298, the call to create_engine within create_table_from_csv located here is using sqlalchemy_uri to create a new SQLAlchemy engine. This works as expected if the URI does not contain a password - however if it does, this string contains the masked password (i.e. XXXXXXXX), and authentication is attempted using that instead. Changing the line to use sqlalchemy_uri_decrypted instead sends the actual password, resolving the issue.

For example:

        # File "superset/db_engine_specs.py", line ~134
        # ...
        df_to_db_kwargs = {
            'table': table,
            'df': df,
            'name': form.name.data,
            'con': create_engine(form.con.data.sqlalchemy_uri_decrypted, echo=False),
            'schema': form.schema.data,
            'if_exists': form.if_exists.data,
            'index': form.index.data,
            'index_label': form.index_label.data,
            'chunksize': 10000,
        }
        # ...

@xrmx
Copy link
Contributor

xrmx commented Mar 6, 2018

@ktravis care to open a PR please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants