Skip to content

Commit

Permalink
Cleanups from code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarp committed Mar 20, 2021
1 parent 9fe2b65 commit b0016ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions plugins/bigquery/dbt/adapters/bigquery/connections.py
Expand Up @@ -594,9 +594,8 @@ def _is_retryable(error):
_SANITIZE_LABEL_PATTERN = re.compile(r"[^a-z0-9_-]")


def _sanitize_label(value: str, max_length: int = 63) -> str:
def _sanitize_label(value: str) -> str:
"""Return a legal value for a BigQuery label."""
value = value.strip().lower()
value = _SANITIZE_LABEL_PATTERN.sub("_", value)
value = value[: max_length]
return value
3 changes: 1 addition & 2 deletions test/unit/test_bigquery_adapter.py
Expand Up @@ -2,6 +2,7 @@
import decimal
import json
import re
import pytest
import unittest
from contextlib import contextmanager
from requests.exceptions import ConnectionError
Expand All @@ -23,7 +24,6 @@
from dbt.logger import GLOBAL_LOGGER as logger # noqa
from dbt.context.providers import RuntimeConfigObject

import pytest
import google.cloud.bigquery

from .utils import config_from_parts_or_dicts, inject_adapter, TestAdapterConversions
Expand Down Expand Up @@ -946,7 +946,6 @@ def test_convert_time_type(self):
@pytest.mark.parametrize(
["input", "output"],
[
("a" * 64, "a" * 63),
("ABC", "abc"),
("a c", "a_c"),
("a ", "a"),
Expand Down

0 comments on commit b0016ee

Please sign in to comment.