def __init__(self, engine_name: str = 'pandas', hostname: typing.List[str] = [], start_time: str = '', end_time: str = '', view: str = 'latest', namespace: typing.List[str] = [], columns: typing.List[str] = ['default'], context=None, table: str = '', config_file=None) -> None: if context is None: self.ctxt = SqContext(engine_name, config_file) else: self.ctxt = context if not self.ctxt: self.ctxt = SqContext(engine_name) self._cfg = self.ctxt.cfg self._schema = SchemaForTable(table, self.ctxt.schemas) self._table = table self._sort_fields = self._schema.key_fields() if not namespace and self.ctxt.namespace: self.namespace = self.ctxt.namespace else: self.namespace = namespace if not hostname and self.ctxt.hostname: self.hostname = self.ctxt.hostname else: self.hostname = hostname if not start_time and self.ctxt.start_time: self.start_time = self.ctxt.start_time else: self.start_time = start_time if not end_time and self.ctxt.end_time: self.end_time = self.ctxt.end_time else: self.end_time = end_time if not view and self.ctxt.view: self.view = self.ctxt.view else: self.view = view self.columns = columns if engine_name and engine_name != '': self.engine = get_sqengine(engine_name, self._table)(self._table, self) elif self.ctxt.engine: self.engine = get_sqengine(self.ctxt.engine, self._table)(self._table, self) if not self.engine: raise ValueError('Unknown analysis engine') self._addnl_filter = None self._addnl_fields = [] self._valid_get_args = None self._valid_assert_args = None self._valid_arg_vals = None
def __init__(self, engine_name: str = '', hostname: typing.List[str] = None, start_time: str = '', end_time: str = '', view: str = '', namespace: typing.List[str] = None, columns: typing.List[str] = None, context=None, table: str = '', config_file=None) -> None: if not context: self.ctxt = SqContext(cfg=load_sq_config(validate=True, config_file=config_file), engine=engine_name) self.ctxt.schemas = Schema(self.ctxt.cfg["schema-directory"]) else: self.ctxt = context if not self.ctxt.cfg: self.ctxt.cfg = load_sq_config(validate=True, config_file=config_file) self.ctxt.schemas = Schema(self.ctxt.cfg["schema-directory"]) if not self.ctxt.engine: self.ctxt.engine = engine_name self._cfg = self.ctxt.cfg self._schema = SchemaForTable(table, self.ctxt.schemas) self._table = table self._sort_fields = self._schema.key_fields() self._convert_args = {} self.namespace = namespace or self.ctxt.namespace or [] self.hostname = hostname or self.ctxt.hostname or [] self.start_time = start_time or self.ctxt.start_time self.end_time = end_time or self.ctxt.end_time view = view or self.ctxt.view if self.start_time and self.end_time and not view: self.view = 'all' else: self.view = view or 'latest' self.columns = columns or ['default'] self._unique_def_column = ['hostname'] if engine_name and engine_name != '': self.engine = get_sqengine(engine_name, self._table)(self) elif self.ctxt.engine: self.engine = get_sqengine(self.ctxt.engine, self._table)(self) if not self.engine: raise ValueError('Unknown analysis engine') self.summarize_df = pd.DataFrame() self._addnl_filter = self._addnl_fields = [] self._valid_get_args = self._valid_assert_args = [] self._valid_arg_vals = self._valid_find_args = [] self._valid_summarize_args = []
def __init__(self, engine="pandas"): self.cfg = load_sq_config(validate=False) self.schemas = Schema(self.cfg["schema-directory"]) self.namespace = "" self.hostname = "" self.start_time = "" self.end_time = "" self.exec_time = "" self.engine_name = engine self.sort_fields = [] self.engine = get_sqengine(engine) super().__init__()
def __init__(self, engine): self.cfg = load_sq_config(validate=False) self.schemas = Schema(self.cfg['schema-directory']) self.namespace = '' self.hostname = '' self.start_time = '' self.end_time = '' self.exec_time = '' self.engine = 'pandas' self.sort_fields = [] self.engine = get_sqengine(self.engine) if not self.engine: # We really should define our own error raise ValueError
def change_engine(self, engine: str): if engine == self.engine_name: return self.engine_name = engine self.engine = get_sqengine(engine)
def __init__(self, engine_name: str = '', hostname: typing.List[str] = [], start_time: str = '', end_time: str = '', view: str = 'latest', namespace: typing.List[str] = [], columns: typing.List[str] = ['default'], context=None, table: str = '') -> None: if context is None: self.ctxt = SqContext(engine_name) else: self.ctxt = context if not self.ctxt: self.ctxt = SqContext(engine_name) self._cfg = self.ctxt.cfg self._schemas = self.ctxt.schemas self._table = table self._sort_fields = [] self._cat_fields = [] self._ign_key_fields = [] # Used when keys != parquet partition cols if not namespace and self.ctxt.namespace: self.namespace = self.ctxt.namespace else: self.namespace = namespace if not hostname and self.ctxt.hostname: self.hostname = self.ctxt.hostname else: self.hostname = hostname if not start_time and self.ctxt.start_time: self.start_time = self.ctxt.start_time else: self.start_time = start_time if not end_time and self.ctxt.end_time: self.end_time = self.ctxt.end_time else: self.end_time = end_time if not view and self.ctxt.view: self.view = self.ctxt.view else: self.view = view self.columns = columns if engine_name and engine_name != '': self.engine = get_sqengine(engine_name) else: self.engine = self.ctxt.engine if self._table: self.engine_obj = self.engine.get_object(self._table, self) else: self.engine_obj = None self._addnl_filter = None self._addnl_fields = []