def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}"): # substitute and save self.__connection = env.build_connection(connection=connection) self.engine = create_engine(self.__connection) Session = sessionmaker(bind=self.engine) self.session = Session()
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}"): # substitute the connection string self.__connection = env.build_connection(connection=connection) self.engine = create_engine(self.__connection) # set some urls self._data_url = "https://github.com/data-hydenv/data/archive/master.zip"
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}", overpass_url=None): # substitute and save self.__connection = env.build_connection(connection=connection) self.engine = create_engine(self.__connection) Session = sessionmaker(bind=self.engine) self.session = Session() # set the Overpass API self.api = Overpass(url=overpass_url)
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}", quiet=True): # substitute and save self.__connection = env.build_connection(connection=connection) self.engine = create_engine(self.__connection) self.quiet = quiet # set some URLs self._github_url = 'https://raw.githubusercontent.com/data-hydenv/data/master/extra/spatial/earthquake/earthquakes.csv'
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}", overwrite_url=None): # substitute and save self.__connection = env.build_connection(connection=connection) self.engine = create_engine(self.__connection) Session = sessionmaker(bind=self.engine) self.session = Session() # set some URLs if overwrite_url is None: self._data_url = 'https://github.com/datasets/geo-countries/raw/master/data/countries.geojson' else: self._data_url = overwrite_url
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}", overwrite_url=None, quiet=True): # substitute and save self.__connection = env.build_connection(connection=connection) self.engine = create_engine(self.__connection) Session = sessionmaker(bind=self.engine) self.session = Session() # set some URLs if overwrite_url is None: self._data_url = 'https://raw.githubusercontent.com/data-hydenv/data/master/extra/spatial/activity/' else: self._data_url = overwrite_url self.quiet = quiet
def run(connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}", legacy=False, **kwargs): """ """ connection = env.build_connection(connection=connection) # check if the legacy exercises app should be used if legacy: backend = kwargs.get('backend', 'local') port = kwargs.get('port', 5000) exercisesApi = HydenvExercises(connection=connection, backend=backend, port=port) exercisesApi.start(no_browser=kwargs.get('no_browser', False)) return # run the new GUI os.system(f"streamlit run {SCRIPTPATH}")
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}", backend='local', port=5000): self.connection = env.build_connection(connection=connection) # backend settings self.backend_use_debug = False self.allow_external = False self._backend_proc = None self._backend_thread = None self.port = port if backend == 'local': self.backend = 'http://localhost:%d/' % port self.backend_use_debug = True elif backend == 'extern' or backend == 'external': self.backend = 'http://localhost:%d/' % port self.backend_use_debug = False self.allow_external = True else: self.backend = backend print(self.backend)
def __init__(self, connection="postgresql://{usr}:{pw}@{host}:{port}/{dbname}"): # substitute and save self.__connection = env.build_connection(connection=connection) # set some URLs self._hobo_table_url = "https://docs.google.com/spreadsheets/d/1uvI1a_OOnCcFjUbHAO1N5nEWejnI5y5vCNt6eueHrOc/edit" self._hobo_data_url = "https://github.com/data-hydenv/data/archive/master.zip" self.__hobo_gid_map = { 'WT17': "#gid=1594319231", 'WT18': "#gid=1500046150", 'WT19': '#gid=651397949', 'WT20': "#gid=0", 'WT21': "#gid=878625339", 'WT22': "#gid=2042487505" } self.__hobo_data_map = { 'WT17': 'hobo/2017/', 'WT18': 'hobo/2018/', 'WT19': 'hobo/2019/', 'WT20': 'hobo/2020/', 'WT21': 'hobo/2021/', 'WT22': 'hobo/2022/' }
def engine(self): if self._engine is None: self.__connection = env.build_connection( connection=self.__connection) self._engine = create_engine(self.__connection) return self._engine