Ejemplo n.º 1
0
from sys import stdout

import click
from colorama import Fore, Style
from pathlib2 import Path
import werkzeug.serving
import yaml

from superset import (
    app, data, db, security_manager,
)
from superset.utils import (
    core as utils, dashboard_import_export, dict_import_export)

config = app.config
celery_app = utils.get_celery_app(config)


def create_app(script_info=None):
    return app


@app.shell_context_processor
def make_shell_context():
    return dict(app=app, db=db)


@app.cli.command()
def init():
    """Inits the Superset application"""
    utils.get_or_create_main_db()
Ejemplo n.º 2
0
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=C,R,W

"""Utility functions used across Superset"""

# Superset framework imports
from superset import app
from superset.utils.core import get_celery_app

# Globals
config = app.config
app = get_celery_app(config)
Ejemplo n.º 3
0
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import NullPool

from superset import app, dataframe, db, results_backend, security_manager
from superset.models.sql_lab import Query
from superset.sql_parse import SupersetQuery
from superset.utils.core import (
    get_celery_app,
    json_iso_dttm_ser,
    now_as_float,
    QueryStatus,
    zlib_compress,
)

config = app.config
celery_app = get_celery_app(config)
stats_logger = app.config.get('STATS_LOGGER')
SQLLAB_TIMEOUT = config.get('SQLLAB_ASYNC_TIME_LIMIT_SEC', 600)
log_query = config.get('QUERY_LOGGER')


class SqlLabException(Exception):
    pass


def get_query(query_id, session, retry_count=5):
    """attemps to get the query and retry if it cannot"""
    query = None
    attempt = 0
    while not query and attempt < retry_count:
        try:
Ejemplo n.º 4
0
from sys import stdout

import click
from colorama import Fore, Style
from pathlib2 import Path
import werkzeug.serving
import yaml

from superset import (
    app, data, db, security_manager,
)
from superset.utils import (
    core as utils, dashboard_import_export, dict_import_export)

config = app.config
celery_app = utils.get_celery_app(config)


def create_app(script_info=None):
    return app


@app.shell_context_processor
def make_shell_context():
    return dict(app=app, db=db)


@app.cli.command()
def init():
    """Inits the Superset application"""
    utils.get_or_create_main_db()