Make sure these boxes are checked before submitting your issue - thank you!
0.20.5
python 3.6.3
It works!
ERROR: {"error": "Connsection failed!\n\nThe error message returned was:\n'NoneType' object has no attribute 'get_password_masked_url_from_uri'"}
Input
Database: People Data
SQLAlchemy URI: mysql://root:password@localhost/People
After clicking "Test Connection" button, the error raised.
I followed the documentation to add a new database connection and faced this error.
I read the core.py and thought the error is raised in "testconn" function.
But I found:
'''
if database and uri:
......
masked_url = database.get_password_masked_url_from_uri(uri)
'''
So I cannot figure out what happened.
I have the same promble, I found it maybe a bug, becasue when i want to add a datasource, the database will not in the superset default db(by debug the code, i found the db is dbs), the code:
if db_name:
database = (
db.session
.query(models.Database)
.filter_by(database_name=db_name)
.first()
)
if database and uri == database.safe_sqlalchemy_uri():
# the password-masked uri was passed
# use the URI associated with this database
uri = database.sqlalchemy_uri_decrypted
url = make_url(uri)
db_engine = models.Database.get_db_engine_spec_for_backend(url.get_backend_name())
db_engine.patch()
uri = db_engine.get_uri_for_impersonation(uri, impersonate_user, username)
masked_url =database.get_password_masked_url_from_uri(uri
notice that db.session.query(models.Database).filter_by(database_name=db_name).first() will always return none(means database=None),because we haven't add the source to dbs, query will return none.
but the last line:
masked_url =database.get_password_masked_url_from_uri(uri)
will make a NoneType mistake,you can modify it like this:
masked_url =models.Database.get_password_masked_url_from_uri(uri)
or you can save it first, then the source will add to the database dbs,then you edit it,click the Test Connection, it can work too.
What do you have in your superset logs?
I made it work, I just ignored the "Test connection" then saved it, I can run queries using postgres
@sjq597 feel free to open a PR, it's easier to review than a comment :)
@xrmx I was going to open a PR, then i fetch the code of master, i found the code is already change, i may do it later when i finished my company work
Thanks a lot!
I have deployed Apache Superset to GCP with this tutorial, but I couldn't connect the PostgreSQL that I have to Superset with SQLAlchemy URI.
I have tried putting them (Superset and PostgreSQL) into same VPC network but still get 502 error after clicking save in the record. Any help would be appreciated! Thanks.
Most helpful comment
I have the same promble, I found it maybe a bug, becasue when i want to add a datasource, the database will not in the superset default db(by debug the code, i found the db is dbs), the code:
notice that db.session.query(models.Database).filter_by(database_name=db_name).first() will always return none(means database=None),because we haven't add the source to dbs, query will return none.
but the last line:
will make a NoneType mistake,you can modify it like this:
or you can save it first, then the source will add to the database dbs,then you edit it,click the Test Connection, it can work too.