Repository: googleapis/python-firestore

Issue:
Firestore: Can't get data in transaction.get call
#### Environment details

1. Specify the API at the beginning of the title: Firestore
2. OS type and version: MacOS 10.15.2
3. Python version and virtual environment information: `python --version`: Python 3.7.4
4. google-cloud-<service> version:  `pip show google-<service>` or `pip freeze`: google-cloud-firestore==1.6.1

#### Steps to reproduce

  1. Create a document in your firestore database.
  2. Run the code below, which will raise an `AttributeError: 'bytes' object has no attribute 'in_progress'`.

#### Code example

```python
transaction = db.transaction()
doc_ref = ... # get a reference to the document you created in step 1 above

@firestore.transactional
def update_in_transaction(transaction, doc_ref):
    docs = transaction.get(doc_ref)
    for doc in docs:
        print(doc)
```

#### Stack trace
```
# Abbreviated stack trace
  File ".../venv/lib/python3.7/site-packages/google/cloud/firestore_v1/client.py", line 440, in get_all
    transaction=_helpers.get_transaction_id(transaction),
  File ".../venv/lib/python3.7/site-packages/google/cloud/firestore_v1/_helpers.py", line 934, in get_transaction_id
    if not transaction.in_progress:
AttributeError: 'bytes' object has no attribute 'in_progress'
```

#### Additional Notes
It appears the helper function `get_transaction_id` is expecting a `Transaction` object, but both the `Transaction.get()` and `Transaction.get_all()` calls are passing a `Transaction._id`. 

When I changed line 230 of transaction.py from:
`return ref_or_query.stream(transaction=self._id)`
to:
`return ref_or_query.stream(transaction=self)`

It appears to fix the issue. 

Discussion:

Patch:
diff --git a/google/cloud/firestore_v1/transaction.py b/google/cloud/firestore_v1/transaction.py
index 9d4068c..04485a8 100644
--- a/google/cloud/firestore_v1/transaction.py
+++ b/google/cloud/firestore_v1/transaction.py
@@ -213,7 +213,7 @@ class Transaction(batch.WriteBatch):
             .DocumentSnapshot: The next document snapshot that fulfills the
             query, or :data:`None` if the document does not exist.
         """
-        return self._client.get_all(references, transaction=self._id)
+        return self._client.get_all(references, transaction=self)
 
     def get(self, ref_or_query):
         """
@@ -225,9 +225,9 @@ class Transaction(batch.WriteBatch):
             query, or :data:`None` if the document does not exist.
         """
         if isinstance(ref_or_query, DocumentReference):
-            return self._client.get_all([ref_or_query], transaction=self._id)
+            return self._client.get_all([ref_or_query], transaction=self)
         elif isinstance(ref_or_query, Query):
-            return ref_or_query.stream(transaction=self._id)
+            return ref_or_query.stream(transaction=self)
         else:
             raise ValueError(
                 'Value for argument "ref_or_query" must be a DocumentReference or a Query.'


Test patch:
diff --git a/tests/unit/v1/test_transaction.py b/tests/unit/v1/test_transaction.py
index 8cae24a..da3c2d0 100644
--- a/tests/unit/v1/test_transaction.py
+++ b/tests/unit/v1/test_transaction.py
@@ -333,7 +333,7 @@ class TestTransaction(unittest.TestCase):
         transaction = self._make_one(client)
         ref1, ref2 = mock.Mock(), mock.Mock()
         result = transaction.get_all([ref1, ref2])
-        client.get_all.assert_called_once_with([ref1, ref2], transaction=transaction.id)
+        client.get_all.assert_called_once_with([ref1, ref2], transaction=transaction)
         self.assertIs(result, client.get_all.return_value)
 
     def test_get_document_ref(self):
@@ -343,7 +343,7 @@ class TestTransaction(unittest.TestCase):
         transaction = self._make_one(client)
         ref = DocumentReference("documents", "doc-id")
         result = transaction.get(ref)
-        client.get_all.assert_called_once_with([ref], transaction=transaction.id)
+        client.get_all.assert_called_once_with([ref], transaction=transaction)
         self.assertIs(result, client.get_all.return_value)
 
     def test_get_w_query(self):
@@ -354,7 +354,7 @@ class TestTransaction(unittest.TestCase):
         query = Query(parent=mock.Mock(spec=[]))
         query.stream = mock.MagicMock()
         result = transaction.get(query)
-        query.stream.assert_called_once_with(transaction=transaction.id)
+        query.stream.assert_called_once_with(transaction=transaction)
         self.assertIs(result, query.stream.return_value)
 
     def test_get_failure(self):