File tree Expand file tree Collapse file tree 2 files changed +6
-19
lines changed
google/cloud/spanner_dbapi Expand file tree Collapse file tree 2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change 14
14
15
15
"""Database cursor for Google Cloud Spanner DB API."""
16
16
17
- import warnings
18
17
from collections import namedtuple
19
18
20
19
import sqlparse
@@ -137,15 +136,11 @@ def description(self):
137
136
def rowcount (self ):
138
137
"""The number of rows produced by the last `execute()` call.
139
138
140
- :raises: :class:`NotImplemented`.
139
+ The property is non-operational and always returns -1. Request
140
+ resulting rows are streamed by the `fetch*()` methods and
141
+ can't be counted before they are all streamed.
141
142
"""
142
- warnings .warn (
143
- "The `rowcount` property is non-operational. Request "
144
- "resulting rows are streamed by the `fetch*()` methods "
145
- "and can't be counted before they are all streamed." ,
146
- UserWarning ,
147
- stacklevel = 2 ,
148
- )
143
+ return - 1
149
144
150
145
@check_not_closed
151
146
def callproc (self , procname , args = None ):
Original file line number Diff line number Diff line change @@ -61,19 +61,11 @@ def test_property_description(self):
61
61
self .assertIsNotNone (cursor .description )
62
62
self .assertIsInstance (cursor .description [0 ], ColumnInfo )
63
63
64
- @mock .patch ("warnings.warn" )
65
- def test_property_rowcount (self , warn_mock ):
64
+ def test_property_rowcount (self ):
66
65
connection = self ._make_connection (self .INSTANCE , self .DATABASE )
67
66
cursor = self ._make_one (connection )
68
67
69
- cursor .rowcount
70
- warn_mock .assert_called_once_with (
71
- "The `rowcount` property is non-operational. Request "
72
- "resulting rows are streamed by the `fetch*()` methods "
73
- "and can't be counted before they are all streamed." ,
74
- UserWarning ,
75
- stacklevel = 2 ,
76
- )
68
+ assert cursor .rowcount == - 1
77
69
78
70
def test_callproc (self ):
79
71
from google .cloud .spanner_dbapi .exceptions import InterfaceError
You can’t perform that action at this time.
0 commit comments