def row(self, row_key, filter_=None, append=False): """Factory to create a row associated with this table. .. warning:: At most one of ``filter_`` and ``append`` can be used in a :class:`Row`. :type row_key: bytes :param row_key: The key for the row being created. :type filter_: :class:`.RowFilter` :param filter_: (Optional) Filter to be used for conditional mutations. See :class:`.DirectRow` for more details. :type append: bool :param append: (Optional) Flag to determine if the row should be used for append mutations. :rtype: :class:`.DirectRow` :returns: A row owned by this table. :raises: :class:`ValueError <exceptions.ValueError>` if both ``filter_`` and ``append`` are used. """ if append and filter_ is not None: raise ValueError('At most one of filter_ and append can be set') if append: return AppendRow(row_key, self) elif filter_ is not None: return ConditionalRow(row_key, self, filter_=filter_) else: return DirectRow(row_key, self)
def append_row(self, row_key): """Create a :class:`~google.cloud.bigtable.row.AppendRow` associated with this table. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_table_append_row] :end-before: [END bigtable_table_append_row] Args: row_key (bytes): The key for the row being created. Returns: A row owned by this table. """ return AppendRow(row_key, self)
def row(self, row_key, filter_=None, append=False): """Factory to create a row associated with this table. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_table_row] :end-before: [END bigtable_table_row] .. warning:: At most one of ``filter_`` and ``append`` can be used in a :class:`~google.cloud.bigtable.row.Row`. :type row_key: bytes :param row_key: The key for the row being created. :type filter_: :class:`.RowFilter` :param filter_: (Optional) Filter to be used for conditional mutations. See :class:`.ConditionalRow` for more details. :type append: bool :param append: (Optional) Flag to determine if the row should be used for append mutations. :rtype: :class:`~google.cloud.bigtable.row.Row` :returns: A row owned by this table. :raises: :class:`ValueError <exceptions.ValueError>` if both ``filter_`` and ``append`` are used. """ warnings.warn( "This method will be deprecated in future versions. Please " "use Table.append_row(), Table.conditional_row() " "and Table.direct_row() methods instead.", PendingDeprecationWarning, stacklevel=2, ) if append and filter_ is not None: raise ValueError("At most one of filter_ and append can be set") if append: return AppendRow(row_key, self) elif filter_ is not None: return ConditionalRow(row_key, self, filter_=filter_) else: return DirectRow(row_key, self)
def _make_append_row(*args, **kwargs): from google.cloud.bigtable.row import AppendRow return AppendRow(*args, **kwargs)