Skip to content

feat: implement row and cell model classes #753

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

Merged
merged 16 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions google/cloud/bigtable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from google.cloud.bigtable.client import Table

from google.cloud.bigtable.read_rows_query import ReadRowsQuery
from google.cloud.bigtable.row import Row
from google.cloud.bigtable.row import Cell
from google.cloud.bigtable.read_rows_query import RowRange
from google.cloud.bigtable.row_response import RowResponse
from google.cloud.bigtable.row_response import CellResponse

from google.cloud.bigtable.mutations_batcher import MutationsBatcher
from google.cloud.bigtable.mutations import Mutation
Expand Down Expand Up @@ -52,6 +52,6 @@
"DeleteRangeFromColumn",
"DeleteAllFromFamily",
"DeleteAllFromRow",
"RowResponse",
"CellResponse",
"Row",
"Cell",
)
14 changes: 7 additions & 7 deletions google/cloud/bigtable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if TYPE_CHECKING:
from google.cloud.bigtable.mutations import Mutation, BulkMutationsEntry
from google.cloud.bigtable.mutations_batcher import MutationsBatcher
from google.cloud.bigtable.row_response import RowResponse
from google.cloud.bigtable.row import Row
from google.cloud.bigtable.read_rows_query import ReadRowsQuery
from google.cloud.bigtable import RowKeySamples
from google.cloud.bigtable.row_filters import RowFilter
Expand Down Expand Up @@ -109,7 +109,7 @@ async def read_rows_stream(
idle_timeout: int | float | None = 300,
per_request_timeout: int | float | None = None,
metadata: list[tuple[str, str]] | None = None,
) -> AsyncIterable[RowResponse]:
) -> AsyncIterable[Row]:
"""
Returns a generator to asynchronously stream back row data.

Expand Down Expand Up @@ -166,7 +166,7 @@ async def read_rows(
per_row_timeout: int | float | None = 10,
per_request_timeout: int | float | None = None,
metadata: list[tuple[str, str]] | None = None,
) -> list[RowResponse]:
) -> list[Row]:
"""
Helper function that returns a full list instead of a generator

Expand All @@ -184,7 +184,7 @@ async def read_row(
operation_timeout: int | float | None = 60,
per_request_timeout: int | float | None = None,
metadata: list[tuple[str, str]] | None = None,
) -> RowResponse:
) -> Row:
"""
Helper function to return a single row

Expand All @@ -206,7 +206,7 @@ async def read_rows_sharded(
idle_timeout: int | float | None = 300,
per_request_timeout: int | float | None = None,
metadata: list[tuple[str, str]] | None = None,
) -> AsyncIterable[RowResponse]:
) -> AsyncIterable[Row]:
"""
Runs a sharded query in parallel

Expand Down Expand Up @@ -410,7 +410,7 @@ async def read_modify_write_row(
*,
operation_timeout: int | float | None = 60,
metadata: list[tuple[str, str]] | None = None,
) -> RowResponse:
) -> Row:
"""
Reads and modifies a row atomically according to input ReadModifyWriteRules,
and returns the contents of all modified cells
Expand All @@ -429,7 +429,7 @@ async def read_modify_write_row(
Failed requests will not be retried.
- metadata: Strings which should be sent along with the request as metadata headers.
Returns:
- RowResponse: containing cell data that was modified as part of the
- Row: containing cell data that was modified as part of the
operation
Raises:
- GoogleAPIError exceptions from grpc call
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from __future__ import annotations

from dataclasses import dataclass
from google.cloud.bigtable.row_response import family_id, qualifier, row_key
from google.cloud.bigtable.row import family_id, qualifier, row_key


class Mutation:
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/mutations_batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import TYPE_CHECKING

from google.cloud.bigtable.mutations import Mutation
from google.cloud.bigtable.row_response import row_key
from google.cloud.bigtable.row import row_key
from google.cloud.bigtable.row_filters import RowFilter

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/read_modify_write_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from dataclasses import dataclass

from google.cloud.bigtable.row_response import family_id, qualifier
from google.cloud.bigtable.row import family_id, qualifier


class ReadModifyWriteRule:
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/read_rows_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .row_response import row_key
from .row import row_key
from dataclasses import dataclass
from google.cloud.bigtable.row_filters import RowFilter

Expand Down
Loading