コード例 #1
0
    def execute_sampling(tbl: LuxSQLTable):
        SAMPLE_FLAG = lux.config.sampling
        SAMPLE_START = lux.config.sampling_start
        SAMPLE_CAP = lux.config.sampling_cap
        SAMPLE_FRAC = 0.2

        length_query = pandas.read_sql(lux.config.query_templates['length_query'].format(table_name = tbl.table_name, where_clause = ""),lux.config.SQLconnection,)
        limit = int(list(length_query["length"])[0]) * SAMPLE_FRAC
        sample_query = lux.config.query_templates['sample_query'].format(table_name = tbl.table_name, where_clause = "", num_rows = str(int(limit)))
        tbl._sampled = pandas.read_sql(sample_query, lux.config.SQLconnection)
コード例 #2
0
    def execute_sampling(tbl: LuxSQLTable):
        SAMPLE_FLAG = lux.config.sampling
        SAMPLE_START = lux.config.sampling_start
        SAMPLE_CAP = lux.config.sampling_cap
        SAMPLE_FRAC = 0.2

        length_query = pandas.read_sql(
            "SELECT COUNT(*) as length FROM {}".format(tbl.table_name),
            lux.config.SQLconnection,
        )
        limit = int(list(length_query["length"])[0]) * SAMPLE_FRAC
        tbl._sampled = pandas.read_sql(
            "SELECT * from {} LIMIT {}".format(tbl.table_name, str(limit)), lux.config.SQLconnection
        )
コード例 #3
0
ファイル: SQLExecutor.py プロジェクト: thyneb19/lux
 def execute_preview(lst: LuxSQLTable):
     lst._sampled = pandas.read_sql(
         "SELECT * from {} LIMIT 5".format(lst.table_name), lux.config.SQLconnection
     )