Exemple #1
0
def test_megaquery_not_detectably_malformed():
    exp = Experiment('slug', '2019-01-01', 8)

    tl = TimeLimits.for_ts(first_enrollment_date='2019-01-01',
                           last_date_full_data='2019-03-01',
                           time_series_period='weekly',
                           num_dates_enrollment=8)

    sql = exp.build_query(
        metric_list=[
            m for m in mad.__dict__.values() if isinstance(m, mad.Metric)
        ],
        time_limits=tl,
        enrollments_query_type='normandy',
    )

    sql_lint(sql)
def test_query_not_detectably_malformed():
    exp = Experiment('slug', '2019-01-01', 8)

    tl = TimeLimits.for_ts(
        first_enrollment_date='2019-01-01',
        last_date_full_data='2019-03-01',
        time_series_period='weekly',
        num_dates_enrollment=8
    )

    sql = exp.build_query(
        metric_list=[],
        time_limits=tl,
        enrollments_query_type='normandy',
    )

    sql_lint(sql)
Exemple #3
0
def test_query_not_detectably_malformed():
    exp = Experiment('slug', '2019-01-01', 8)

    tl = TimeLimits.for_ts(first_enrollment_date='2019-01-01',
                           last_date_full_data='2019-03-01',
                           time_series_period='weekly',
                           num_dates_enrollment=8)

    sql = exp.build_query(
        metric_list=[],
        time_limits=tl,
        enrollments_query_type='normandy',
    )

    # This query is actually slightly malformed, due to a trailing comma.
    # We should add a metric here if the linter ever improves.

    sql_lint(sql)
Exemple #4
0
def dry_run_query(exp_path):
    report = validate_schema(op.join(exp_path, "report.json"))
    metric_list = _make_metric_list(report)

    exp = Experiment(experiment_slug=report["experiment_slug"],
                     start_date=report["start_date"],
                     num_dates_enrollment=report["num_dates_enrollment"])
    # create an archive of the sql generating analysis
    time_limits = TimeLimits.for_single_analysis_window(
        first_enrollment_date=report['start_date'],
        last_date_full_data=report['last_date_full_data'],
        analysis_start_days=report['analysis_start_days'],
        analysis_length_dates=report['analysis_length_days'],
        num_dates_enrollment=report['num_dates_enrollment'])
    query = exp.build_query(metric_list=metric_list,
                            time_limits=time_limits,
                            enrollments_query_type='normandy')

    return query