turu.snowflake¶
turu.snowflake.Connection
¶
A connection to a Snowflake database.
This class is a wrapper around the snowflake.connector.SnowflakeConnection
class.
Source code in turu-snowflake/src/turu/snowflake/connection.py
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
|
close()
¶
commit()
¶
connect(connection_name=None, connections_file_path=None, user=None, password=None, account=None, database=None, schema=None, warehouse=None, role=None, **kwargs)
classmethod
¶
Connect to a database.
Source code in turu-snowflake/src/turu/snowflake/connection.py
connect_from_env(connection_name=None, connections_file_path=None, user_envname='SNOWFLAKE_USER', password_envname='SNOWFLAKE_PASSWORD', account_envname='SNOWFLAKE_ACCOUNT', database_envname='SNOWFLAKE_DATABASE', schema_envname='SNOWFLAKE_SCHEMA', warehouse_envname='SNOWFLAKE_WAREHOUSE', role_envname='SNOWFLAKE_ROLE', authenticator_envname='SNOWFLAKE_AUTHENTICATOR', **kwargs)
classmethod
¶
Connect to a database using environment variables.
Source code in turu-snowflake/src/turu/snowflake/connection.py
cursor()
¶
execute(operation, parameters=None, /, **options)
¶
Prepare and execute a database operation (query or command).
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().execute()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/connection.py
execute_map(row_type, operation, parameters=None, /, **options)
¶
execute_map(row_type: Type[GenericNewRowType], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> Cursor[GenericNewRowType, Never, Never]
execute_map(row_type: Type[GenericNewPandasDataFrame], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> Cursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) and map each row to a row_type
.
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().execute_map()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Union[Type[GenericNewRowType], Type[GenericNewPandasDataFrame], Type[GenericNewPyArrowTable], Type[GenericNewPanderaDataFrameModel]]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/connection.py
executemany(operation, seq_of_parameters, /, **options)
¶
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings.
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().executemany()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/connection.py
executemany_map(row_type, operation, seq_of_parameters, /, **options)
¶
executemany_map(row_type: Type[GenericNewRowType], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> Cursor[GenericNewRowType, Never, Never]
executemany_map(row_type: Type[GenericNewPandasDataFrame], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> Cursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) against all parameter sequences or mappings.
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().executemany_map()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Union[Type[GenericNewRowType], Type[GenericNewPandasDataFrame], Type[GenericNewPyArrowTable], Type[GenericNewPanderaDataFrameModel]]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/connection.py
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.snowflake.Cursor
¶
A cursor is a database object that is used to manage the context of a fetch operation.
This class is a wrapper around the snowflake.connector.cursor.SnowflakeCursor
class.
Source code in turu-snowflake/src/turu/snowflake/cursor.py
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
|
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 number of rows that the last .execute*()
produced (for DQL statements like )
or affected (for DML statements like or ).
The attribute is -1
in case no .execute*()
has been performed
on the cursor or the rowcount of the last operation is cannot be determined by the interface.
execute(operation, parameters=None, /, **options)
¶
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[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/cursor.py
execute_map(row_type, operation, parameters=None, /, **options)
¶
execute_map(row_type: Type[GenericNewRowType], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> Cursor[GenericNewRowType, Never, Never]
execute_map(row_type: Type[GenericNewPandasDataFrame], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> Cursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) and map each row to a row_type
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Union[Type[GenericNewRowType], Type[GenericNewPandasDataFrame], Type[GenericNewPyArrowTable], Type[GenericNewPanderaDataFrameModel]]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/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
.
Source code in turu-snowflake/src/turu/snowflake/cursor.py
executemany(operation, seq_of_parameters, /, **options)
¶
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[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/cursor.py
executemany_map(row_type, operation, seq_of_parameters, /, **options)
¶
executemany_map(row_type: Type[GenericNewRowType], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> Cursor[GenericNewRowType, Never, Never]
executemany_map(row_type: Type[GenericNewPandasDataFrame], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> Cursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) against all parameter sequences or mappings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Union[Type[GenericNewRowType], Type[GenericNewPandasDataFrame], Type[GenericNewPyArrowTable], Type[GenericNewPanderaDataFrameModel]]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
Cursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/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-snowflake/src/turu/snowflake/cursor.py
fetch_arrow_all()
¶
fetch_arrow_batches()
¶
Fetches Arrow Tables in batches, where 'batch' refers to Snowflake Chunk.
Source code in turu-snowflake/src/turu/snowflake/cursor.py
fetch_pandas_all(**kwargs)
¶
Fetch a single Pandas dataframe.
Source code in turu-snowflake/src/turu/snowflake/cursor.py
fetch_pandas_batches(**kwargs)
¶
Fetch Pandas dataframes in batches, where 'batch' refers to Snowflake Chunk.
Source code in turu-snowflake/src/turu/snowflake/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-snowflake/src/turu/snowflake/cursor.py
fetchone()
¶
Fetch the next row of a query result set.
Source code in turu-snowflake/src/turu/snowflake/cursor.py
use_database(database)
¶
use_role(role)
¶
use_schema(schema)
¶
turu.snowflake.AsyncConnection
¶
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
|
close()
async
¶
commit()
async
¶
connect(connection_name=None, connections_file_path=None, user=None, password=None, account=None, database=None, schema=None, warehouse=None, role=None, **kwargs)
async
classmethod
¶
Connect to a database.
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
connect_from_env(connection_name=None, connections_file_path=None, user_envname='SNOWFLAKE_USER', password_envname='SNOWFLAKE_PASSWORD', account_envname='SNOWFLAKE_ACCOUNT', database_envname='SNOWFLAKE_DATABASE', schema_envname='SNOWFLAKE_SCHEMA', warehouse_envname='SNOWFLAKE_WAREHOUSE', role_envname='SNOWFLAKE_ROLE', authenticator_envname='SNOWFLAKE_AUTHENTICATOR', **kwargs)
async
classmethod
¶
Connect to a database using environment variables.
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
cursor()
async
¶
execute(operation, parameters=None, /, **options)
async
¶
Prepare and execute a database operation (query or command).
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().execute()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
execute_map(row_type, operation, parameters=None, /, **options)
async
¶
execute_map(row_type: Type[GenericNewRowType], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[GenericNewRowType, Never, Never]
execute_map(row_type: Type[GenericNewPandasDataFrame], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) and map each row to a row_type
.
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().execute_map()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Union[Type[GenericNewRowType], Type[GenericNewPandasDataFrame], Type[GenericNewPyArrowTable], Type[GenericNewPanderaDataFrameModel]]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
executemany(operation, seq_of_parameters, /, **options)
async
¶
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings.
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().executemany()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
executemany_map(row_type, operation, seq_of_parameters, /, **options)
async
¶
executemany_map(row_type: Type[GenericNewRowType], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[GenericNewRowType, Never, Never]
executemany_map(row_type: Type[GenericNewPandasDataFrame], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) against all parameter sequences or mappings.
This is not defined in PEP 249,
but is simply a convenient shortcut to .cursor().executemany_map()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_connection.py
rollback()
async
¶
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.snowflake.AsyncCursor
¶
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
arraysize: int
property
writable
¶
This read/write attribute specifies the number of rows to fetch at a time with .fetchmany()
.
It defaults to 1 meaning to fetch a single row at a time.
Implementations must observe this value with respect to the .fetchmany()
method,
but are free to interact with the database a single row at a time.
It may also be used in the implementation of .executemany()
.
rowcount: int
property
¶
the number of rows that the last .execute*() produced (for DQL statements like ) or affected (for DML statements like or ).
The attribute is -1 in case no .execute*() has been performed on the cursor or the rowcount of the last operation is cannot be determined by the interface.
execute(operation, parameters=None, /, **options)
async
¶
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[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
execute_map(row_type, operation, parameters=None, /, **options)
async
¶
execute_map(row_type: Type[GenericNewRowType], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[GenericNewRowType, Never, Never]
execute_map(row_type: Type[GenericNewPandasDataFrame], operation: str, parameters: Optional[Any] = None, /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) and map each row to a row_type
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row_type
|
Union[Type[GenericNewRowType], Type[GenericNewPandasDataFrame], Type[GenericNewPyArrowTable], Type[GenericNewPanderaDataFrameModel]]
|
The type of the row that will be returned. |
required |
operation
|
str
|
A database operation (query or command). |
required |
parameters
|
Optional[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
None
|
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
execute_with_tag(tag, operation, parameters=None)
async
¶
Execute a database operation (Insert, Update, Delete) with a tag.
This is not defined in PEP 249,
This method executes an operation (Insert, Update, Delete) that does not return a value with a tag. This tag is used to verify that the specified operation is executed in order when testing with Mock.
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
executemany(operation, seq_of_parameters, /, **options)
async
¶
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings.
Caution
executemany does not support async. Actually, this is sync.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor[Tuple[Any], PandasDataFrame, PyArrowTable]
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
executemany_map(row_type, operation, seq_of_parameters, /, **options)
async
¶
executemany_map(row_type: Type[GenericNewRowType], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[GenericNewRowType, Never, Never]
executemany_map(row_type: Type[GenericNewPandasDataFrame], operation: str, seq_of_parameters: Sequence[Any], /, **options: Unpack[ExecuteOptions]) -> AsyncCursor[Never, GenericNewPandasDataFrame, Never]
Execute a database operation (query or command) against all parameter sequences or mappings.
Caution
executemany does not support async. Actually, this is sync.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operation
|
str
|
A database operation (query or command). |
required |
seq_of_parameters
|
Sequence[Any]
|
Parameters may be provided as sequence or mapping and will be bound to variables in the operation. |
required |
options
|
Unpack[ExecuteOptions]
|
snowflake connector options |
{}
|
Returns:
Type | Description |
---|---|
AsyncCursor
|
A cursor that holds a reference to an operation. |
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
executemany_with_tag(tag, operation, seq_of_parameters)
async
¶
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 executes an operation (Insert, Update, Delete) that does not return a value with a tag. This tag is used to verify that the specified operation is executed in order when testing with Mock.
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
fetch_arrow_all()
async
¶
Fetches a single Arrow Table.
fetch_arrow_batches()
async
¶
Fetches Arrow Tables in batches, where 'batch' refers to Snowflake Chunk.
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
fetch_pandas_all(**kwargs)
async
¶
Fetch Pandas dataframes.
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
fetch_pandas_batches(**kwargs)
async
¶
Fetch Pandas dataframes in batches, where 'batch' refers to Snowflake Chunk.
Source code in turu-snowflake/src/turu/snowflake/async_cursor.py
fetchall()
async
¶
fetchmany(size=None)
async
¶
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-snowflake/src/turu/snowflake/async_cursor.py
fetchone()
async
¶
Fetch the next row of a query result set.