DataBrewery / cubes

[NOT MAINTAINED] Light-weight Python OLAP framework for multi-dimensional data analysis
http://cubes.databrewery.org
Other
1.49k stars 314 forks source link

Settings and type-aware extension creation #429

Closed Stiivi closed 7 years ago

Stiivi commented 7 years ago

This change introduces a SettingsDict – a dictionary tied to a list of Setting objects which describe the keys and their types. The extension is now defined as:

# Store is subclass of Extensible
class MyStore(Store, name="my"):
    extension_desc = "My custom store. It limits number the queries."

    extension_settings = [
        Setting("url", "string", desc="Connection URL),
        Setting("query_limit", "integer", desc="Max number of rows returned", default=1000),
    ]

    url: str
    query_limit: int

    def __init__(self, url: str, query_limit: int):
        self.url = url
        self.query_limit = query_limit

The extension can be initialized by two ways:

One can see all the details of extensions by running: slicer extension TYPE NAME. To list all extensions: slicer extension TYPE or just slicer extension.

Stiivi commented 7 years ago

Wrong branch to merge on