Skip to content

Unable to insert or update JSON #1759

@pacepace

Description

@pacepace

Environment details

  • OS type and version: Windows 11 WSL2 Ubuntu 22.04
  • Python version: 3.10.12
  • pip version: 23.3.1
  • google-cloud-bigquery version: 3.14.1

Steps to reproduce

The problem is in this code in query.py:

def to_api_repr(self) -> dict:
       """Construct JSON API representation for the parameter.

       Returns:
           Dict: JSON mapping
       """
       value = self.value
       converter = _SCALAR_VALUE_TO_JSON_PARAM.get(self.type_)
       if converter is not None:
           value = converter(value)  # type: ignore
       resource: Dict[str, Any] = {
           "parameterType": {"type": self.type_},
           "parameterValue": {"value": value},
       }
       if self.name is not None:
           resource["name"] = self.name
       return resource

As you can see, it calls converter with one argument. When using JSON, it uses this converter in _helpers.py:

def _json_from_json(value, field):
    """Coerce 'value' to a pythonic JSON representation, if set or not nullable."""
    if _not_null(value, field):
        return json.loads(value)

That needs two arguments and it is being given only one resulting in a TypeError: converter() missing 1 required positional argument: 'field'

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-bigquery API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions