Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Untyped param #1001

Merged
merged 13 commits into from
Feb 13, 2024
Next Next commit
changes
  • Loading branch information
asthamohta committed Jul 19, 2023
commit e5a1830c021cce612e02e8495a12068fb59fcef3
2 changes: 1 addition & 1 deletion google/cloud/spanner_v1/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def execute_partitioned_dml(
from google.cloud.spanner_v1.transaction import Transaction

if param_types is None:
raise ValueError("Specify 'param_types' when passing 'params'.")
param_types = {}
params_pb = Transaction._make_params_pb(params, param_types)
else:
params_pb = {}
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/spanner_v1/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def execute_sql(

if params is not None:
if param_types is None:
raise ValueError("Specify 'param_types' when passing 'params'.")
param_types = {}
params_pb = Struct(
fields={key: _make_value_pb(value) for key, value in params.items()}
)
Expand Down Expand Up @@ -633,7 +633,7 @@ def partition_query(

if params is not None:
if param_types is None:
raise ValueError("Specify 'param_types' when passing 'params'.")
param_types = {}
params_pb = Struct(
fields={key: _make_value_pb(value) for (key, value) in params.items()}
)
Expand Down
5 changes: 0 additions & 5 deletions google/cloud/spanner_v1/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,9 @@ def _make_params_pb(params, param_types):
If ``params`` is None but ``param_types`` is not None.
"""
if params is not None:
if param_types is None:
raise ValueError("Specify 'param_types' when passing 'params'.")
return Struct(
fields={key: _make_value_pb(value) for key, value in params.items()}
)
else:
if param_types is not None:
raise ValueError("Specify 'params' when passing 'param_types'.")

return {}

Expand Down
32 changes: 31 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,37 @@
namespaces = ["google"]
if "google.cloud" in packages:
namespaces.append("google.cloud")

print(
[name,
version,
description,
readme,
"Google LLC",
"[email protected]",
"Apache 2.0",
url,
[
release_status,
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
"Topic :: Internet",
],
"Posix; MacOS X; Windows",
packages,
namespaces,
dependencies,
extras,
">=3.7",
True,
False]
)
setuptools.setup(
name=name,
version=version,
Expand Down