mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
* Generalize switch between different datasources. * Fix previous migration since slice model changed * Fix warm up cache and other small stuff * Adding modules and datasources through config * Replace tabs w/ spaces * Fix other style issues * Change add method for SliceModelView to pick the first non-empty ds * Remove tests on slice add redirect * Change way of db migration * Fix styling * Fix create slice * Small fixes * Fix code climate check * Adding notes on how to create new datasource in CONTRIBUTING.md * Fix last merge * A commit just to trigger travis build again * Add migration to merge two heads * Fix codeclimate * Simplify source_registry * Fix codeclimate * Remove all getter methods
16 lines
484 B
Python
16 lines
484 B
Python
from flask import flash
|
|
|
|
|
|
class SourceRegistry(object):
|
|
""" Central Registry for all available datasource engines"""
|
|
|
|
sources = {}
|
|
|
|
def add_source(self, ds_type, cls_model):
|
|
if ds_type not in self.sources:
|
|
self.sources[ds_type] = cls_model
|
|
if self.sources[ds_type] is not cls_model:
|
|
raise Exception(
|
|
'source type: {} is already associated with Model: {}'.format(
|
|
ds_type, self.sources[ds_type]))
|