This commit is contained in:
Daniel Thorn 2022-11-30 11:45:05 -08:00 коммит произвёл GitHub
Родитель c2e9232162
Коммит c281400486
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 30 добавлений и 38 удалений

Просмотреть файл

@ -15,13 +15,13 @@ from ..cli.generate import generate
from ..cli.query import query
from ..cli.routine import mozfun, routine
from ..cli.view import view
from ..copy_deduplicate import copy_deduplicate
from ..dependency import dependency
from ..docs import docs_
from ..glam.cli import glam
from ..static import static_
from ..stripe import stripe_
from ..subplat.apple import apple
from ..copy_deduplicate import copy_deduplicate
def cli(prog_name=None):

Просмотреть файл

@ -5,11 +5,11 @@ import glob
import os
import re
import sys
from functools import partial
from multiprocessing.pool import Pool
from typing import Set
import click
from functools import partial
from google.cloud import bigquery
from ..cli.utils import is_authenticated

Просмотреть файл

@ -1,10 +1,11 @@
"""bigquery-etl CLI generate command."""
from bigquery_etl.cli.utils import is_valid_project
import click
from pathlib import Path
import importlib.util
from inspect import getmembers
from pathlib import Path
import click
from bigquery_etl.cli.utils import is_valid_project
SQL_GENERATORS_DIR = "sql_generators"
GENERATE_COMMAND = "generate"

Просмотреть файл

@ -1,24 +1,24 @@
"""bigquery-etl CLI view command."""
import click
import functools
import logging
import re
import string
import sys
from multiprocessing.pool import Pool, ThreadPool
from ..view import View, broken_views
from .dryrun import dryrun
import click
from ..cli.utils import (
sql_dir_option,
use_cloud_function_option,
parallelism_option,
paths_matching_name_pattern,
project_id_option,
respect_dryrun_skip_option,
sql_dir_option,
use_cloud_function_option,
)
from ..metadata.parse_metadata import Metadata, METADATA_FILE
from ..metadata.parse_metadata import METADATA_FILE, Metadata
from ..view import View, broken_views
from .dryrun import dryrun
VIEW_NAME_RE = re.compile(r"(?P<dataset>[a-zA-z0-9_]+)\.(?P<name>[a-zA-z0-9_]+)")

Просмотреть файл

@ -7,7 +7,7 @@ from argparse import ArgumentParser
from ..util import standard_args
from ..util.common import project_dirs
from .parse_metadata import Metadata, DatasetMetadata
from .parse_metadata import DatasetMetadata, Metadata
parser = ArgumentParser(description=__doc__)

Просмотреть файл

@ -14,13 +14,13 @@ from .sql_test import (
Table,
coerce_result,
dataset,
default_encoding,
get_query_params,
load,
load_tables,
load_views,
print_and_test,
read,
default_encoding,
)
expect_names = {f"expect.{ext}" for ext in ("yaml", "json", "ndjson")}

Просмотреть файл

@ -5,12 +5,11 @@ import random
import re
import string
import warnings
from typing import List
from pathlib import Path
from typing import List
from uuid import uuid4
from google.cloud import bigquery
from jinja2 import Environment, FileSystemLoader
from bigquery_etl.format_sql.formatter import reformat

Просмотреть файл

@ -6,7 +6,6 @@ import re
from argparse import Action
from functools import partial
from google.cloud import bigquery
from bigquery_etl.util.common import TempDatasetReference

Просмотреть файл

@ -1,19 +1,18 @@
"""Represents a SQL view."""
import string
import time
from pathlib import Path
import attr
import sqlparse
import string
import time
from google.api_core.exceptions import BadRequest
from google.cloud import bigquery
from pathlib import Path
from bigquery_etl.format_sql.formatter import reformat
from bigquery_etl.metadata.parse_metadata import DatasetMetadata, DATASET_METADATA_FILE
from bigquery_etl.util import extract_from_query_path
from bigquery_etl.metadata.parse_metadata import DATASET_METADATA_FILE, DatasetMetadata
from bigquery_etl.schema import Schema
from bigquery_etl.util import extract_from_query_path
# skip validation for these views
SKIP_VALIDATION = {

Просмотреть файл

@ -15,8 +15,8 @@ python3.10 -m venv venv/
# build java dependencies with maven
mvn package
# run pytest with all linters and 4 workers in parallel
./venv/bin/pytest --black --pydocstyle --flake8 --mypy-ignore-missing-imports -n 4
# run pytest with all linters and 8 workers in parallel
./venv/bin/pytest --black --flake8 --isort --mypy-ignore-missing-imports --pydocstyle -n 8
# use -k to selectively run a set of tests that matches the expression `udf`
./venv/bin/pytest -k udf

Просмотреть файл

@ -22,7 +22,7 @@ if [ "$#" = 0 ]; then
# When using pytest-xdist, total worker initialization time scales
# linearly to the number of workers. 8 workers seems to bring the best
# performance. See https://github.com/pytest-dev/pytest-xdist/issues/346
exec pytest --black --flake8 --mypy-ignore-missing-imports --pydocstyle -n 8
exec pytest --black --flake8 --isort --mypy-ignore-missing-imports --pydocstyle -n 8
elif [ "${1:0:1}" = - ]; then
# First argument is a flag, assume intended executable is pytest
exec pytest "$@"

Просмотреть файл

@ -4,12 +4,7 @@ import pytest
import yaml
from click.testing import CliRunner
from bigquery_etl.cli.query import (
paths_matching_name_pattern,
create,
info,
schedule,
)
from bigquery_etl.cli.query import create, info, paths_matching_name_pattern, schedule
class TestQuery:

Просмотреть файл

@ -1,9 +1,8 @@
import os
from unittest.mock import patch
from click.testing import CliRunner
import yaml
from click.testing import CliRunner
from bigquery_etl.cli.query import run

Просмотреть файл

@ -1,8 +1,8 @@
import pytest
from click.testing import CliRunner
from pathlib import Path
import pytest
from click.testing import CliRunner
from bigquery_etl.view import View
TEST_DIR = Path(__file__).parent.parent