turu.bigquery¶
turu.bigquery.Connection
¶
Source code in turu-bigquery/src/turu/bigquery/connection.py
close()
¶
commit()
¶
connect(client=None, bqstorage_client=None)
classmethod
¶
Connect to a database.
Source code in turu-bigquery/src/turu/bigquery/connection.py
connect_from_env(*args, **kwargs)
classmethod
¶
cursor()
¶
rollback()
¶
Roll back to the start of any pending transaction.
Closing a connection without committing the changes first will cause an implicit rollback to be performed.
turu.bigquery.Cursor
¶
Source code in turu-bigquery/src/turu/bigquery/cursor.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
arraysize: int
property
writable
¶
The number of rows to fetch at a time with .fetchmany()
.
It defaults to 1 meaning to fetch a single row at a time.
rowcount: int
property
¶
The rowcount for the last .execute*() operation.
Per PEP 249: The attribute is -1 in case no .execute*() has been performed on the cursor or the rowcount of the last operation cannot be determined by the interface.
execute(operation, parameters=None)
¶
Prepare and execute a database operation (query or command).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Parameters]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
Returns:
Type | Description |
---|---|
Self
|
A cursor that holds a reference to an operation. |
execute_map(row_type, operation, parameters=None)
¶
Execute a database operation (query or command) and map each row to a row_type
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Type[GenericNewRowType]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Parameters]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
Returns:
Type | Description |
---|---|
Cursor[GenericNewRowType, Parameters]
|
A cursor that holds a reference to an operation. |
Source code in turu-bigquery/src/turu/bigquery/cursor.py
execute_with_tag(tag, operation, parameters=None)
¶
Execute a database operation (Insert, Update, Delete) with a tag.
This is not defined in PEP 249,
This method is provided for testing,
and is intended to be used in conjunction with MockConnection.inject_operation_with_tag
.
executemany(operation, seq_of_parameters)
¶
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Parameters]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
Returns:
Type | Description |
---|---|
Self
|
A cursor that holds a reference to an operation. |
Source code in turu-bigquery/src/turu/bigquery/cursor.py
executemany_map(row_type, operation, seq_of_parameters)
¶
Execute a database operation (query or command) against all parameter sequences or mappings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Type[GenericNewRowType]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Parameters]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
Returns:
Type | Description |
---|---|
Cursor[GenericNewRowType, Parameters]
|
A cursor that holds a reference to an operation. |
Source code in turu-bigquery/src/turu/bigquery/cursor.py
executemany_with_tag(tag, operation, seq_of_parameters)
¶
Execute a database operation (Insert, Update, Delete) against all parameter sequences or mappings with a tag.
This is not defined in PEP 249,
This method is provided for testing,
and is intended to be used in conjunction with MockConnection.inject_operation_with_tag
.
Source code in turu-bigquery/src/turu/bigquery/cursor.py
fetchall()
¶
fetchmany(size=None)
¶
Fetch the next set of rows of a query result.
An empty sequence is returned when no more rows are available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size
|
Optional[int]
|
The number of rows to fetch per call.
If this parameter is not used, it is usually refer to use the |
None
|
Source code in turu-bigquery/src/turu/bigquery/cursor.py
fetchone()
¶
Fetch the next row of a query result set.