# Path: plenario/database.py
# def create_database(bind: Engine, database: str) -> None:
# def drop_database(bind: Engine, database: str) -> None:
# def create_extension(bind: Engine, extension: str) -> None:
# def psql(path: str) -> None:
# def postgres_session_context():
# def redshift_session_context():
# 
# Path: plenario/models/SensorNetwork.py
# class SensorMeta(postgres_base):
#     __tablename__ = 'sensor__sensor_metadata'
# 
#     name = Column(String, primary_key=True)
#     observed_properties = Column(JSONB)
#     info = Column(JSONB)
# 
#     def features(self) -> set:
#         """Return the features that this sensor reports on.
#         """
#         return {e.split('.')[0] for e in self.tree()}
# 
#     def __repr__(self):
#         return '<Sensor {!r}>'.format(self.name)
# 
#     def tree(self):
#         return {v: k for k, v in self.observed_properties.items()}
# 
# Path: plenario/settings.py
# REDIS_HOST = get('REDIS_HOST', 'localhost')


from json import dumps, loads
from flask import Blueprint
from redis import Redis
from sqlalchemy import desc, select
from plenario.database import redshift_base as rshift_base
from plenario.models.SensorNetwork import SensorMeta
from plenario.settings import REDIS_HOST



blueprint = Blueprint('apiary', __name__)
redis = Redis(REDIS_HOST)


def index() -> list:
    """Generate the information necessary for displaying unknown features on the
    admin index page.
    """

# Path: plenario/database.py
# def create_database(bind: Engine, database: str) -> None:
# def drop_database(bind: Engine, database: str) -> None:
# def create_extension(bind: Engine, extension: str) -> None:
# def psql(path: str) -> None:
# def postgres_session_context():
# def redshift_session_context():
# 
# Path: plenario/models/SensorNetwork.py
# class SensorMeta(postgres_base):
#     __tablename__ = 'sensor__sensor_metadata'
# 
#     name = Column(String, primary_key=True)
#     observed_properties = Column(JSONB)
#     info = Column(JSONB)
# 
#     def features(self) -> set:
#         """Return the features that this sensor reports on.
#         """
#         return {e.split('.')[0] for e in self.tree()}
# 
#     def __repr__(self):
#         return '<Sensor {!r}>'.format(self.name)
# 
#     def tree(self):
#         return {v: k for k, v in self.observed_properties.items()}
# 
# Path: plenario/settings.py
# REDIS_HOST = get('REDIS_HOST', 'localhost')


# Path: plenario/apiary/views.py
from json import dumps, loads
from flask import Blueprint
from redis import Redis
from sqlalchemy import desc, select
from plenario.database import redshift_base as rshift_base
from plenario.models.SensorNetwork import SensorMeta
from plenario.settings import REDIS_HOST




blueprint = Blueprint('apiary', __name__)
redis = Redis(REDIS_HOST)


def index() -> list:
    """Generate the information necessary for displaying unknown features on the
    admin index page.
    """

    rshift_base.metadata.reflect()