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 1414
1515"""Database cursor for Google Cloud Spanner DB API."""
1616
17- import warnings
1817from collections import namedtuple
1918
2019import sqlparse
@@ -137,15 +136,11 @@ def description(self):
137136 def rowcount (self ):
138137 """The number of rows produced by the last `execute()` call.
139138
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.
141142 """
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
149144
150145 @check_not_closed
151146 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):
6161 self .assertIsNotNone (cursor .description )
6262 self .assertIsInstance (cursor .description [0 ], ColumnInfo )
6363
64- @mock .patch ("warnings.warn" )
65- def test_property_rowcount (self , warn_mock ):
64+ def test_property_rowcount (self ):
6665 connection = self ._make_connection (self .INSTANCE , self .DATABASE )
6766 cursor = self ._make_one (connection )
6867
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
7769
7870 def test_callproc (self ):
7971 from google .cloud .spanner_dbapi .exceptions import InterfaceError
You can’t perform that action at this time.
0 commit comments