def get_django_stores(): """Return a dictionary of configured stores for django.""" settings = get_connection_settings() storm_stores = {} for key, cfg in settings.items(): storm_stores[key] = get_postgres_uri(cfg) return storm_stores
def _format_postgres_admin_uri(store_name): """Internal function that formats a URI for a local admin connection""" cfg = get_connection_settings()[store_name] #bypass username & password to get an admin config cfg['username'] = None cfg['password'] = None cfg['options'] = None return get_postgres_uri(cfg)
def get_store(store_name, zstorm=None): """Return the Storm.Store for the given schema""" if not zstorm: zstorm = account_zstorm settings = get_connection_settings() # get the current transaction and see if it has the ro_store flag set txn = zstorm.transaction_manager.get() if getattr(txn, 'use_ro_store', False): # only use it if there is a config for it. ro_store_name = 'ro-%s' % store_name if ro_store_name in settings: store_name = ro_store_name store_settings = settings[store_name] uri = get_postgres_uri(store_settings) return zstorm.get(store_name, default_uri=uri)