mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
Stabilizing Celery / SQL Lab (#2981)
* upgrade celery to 4.0.2 * using Redis for unit tests (sqla broker not supported in Celery 4) * Setting Celery's soft_time_limit based on `SQLLAB_ASYNC_TIME_LIMIT_SEC` config * Better error handling in async tasks * Better statsd logging in async tasks * show [pending/running] query status in Results tab * systematically using sqla NullPool on worker (async) to limit number of database connections
This commit is contained in:
committed by
GitHub
parent
de88764e93
commit
06fcaa3095
@@ -30,6 +30,7 @@ from sqlalchemy import (
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.orm.session import make_transient
|
||||
from sqlalchemy.pool import NullPool
|
||||
from sqlalchemy.sql import text
|
||||
from sqlalchemy.sql.expression import TextAsFrom
|
||||
from sqlalchemy_utils import EncryptedType
|
||||
@@ -560,10 +561,12 @@ class Database(Model, AuditMixinNullable):
|
||||
conn.password = password_mask if conn.password else None
|
||||
self.sqlalchemy_uri = str(conn) # hides the password
|
||||
|
||||
def get_sqla_engine(self, schema=None):
|
||||
def get_sqla_engine(self, schema=None, nullpool=False):
|
||||
extra = self.get_extra()
|
||||
uri = make_url(self.sqlalchemy_uri_decrypted)
|
||||
params = extra.get('engine_params', {})
|
||||
if nullpool:
|
||||
params['poolclass'] = NullPool
|
||||
uri = self.db_engine_spec.adjust_database_uri(uri, schema)
|
||||
return create_engine(uri, **params)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user