Bases: object
class that represents a blob collection in crate.
can be used to download, upload and delete blobs
Delete a blob
Parameters: | digest – the hex digest of the blob to be deleted |
---|---|
Returns: | True if blob existed |
Check if a blob exists
Parameters: | digest – Hex digest of the blob |
---|---|
Returns: | Boolean indicating existence of the blob |
Return the contents of a blob
Parameters: | digest – the hex digest of the blob to return |
---|---|
Returns: | generator returning chunks of data |
Upload a blob
Parameters: |
|
---|---|
Returns: | The hex digest of the uploaded blob if not provided in the call. Otherwise a boolean indicating if the blob has been newly created |
Bases: object
Close the connection now
Transactions are not supported, so commit is not implemented.
Return a new Cursor Object using the connection.
Retrieve a BlobContainer for container_name
Parameters: | container_name – the name of the BLOB container. |
---|---|
Returns: | a :class:ContainerObject |
Create a :class:Connection object
Parameters: |
|
---|
>>> connect(['host1:9200', 'host2:9200'])
<Connection <Client ['host1:9200', 'host2:9200']>>
crate cli
can be used to query crate using SQL
Bases: cmd.Cmd
connect to one or more server with “connect servername:port”
execute a SQL delete statement
exit the shell
execute a SQL insert statement
exit the shell
execute a SQL select statement
execute a SQL update statement
Bases: object
not thread-safe by intention should not be shared between different threads
Close the cursor now
This read-only attribute is a sequence of 7-item sequences.
Prepare and execute a database operation (query or command).
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters.
Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor’s arraysize attribute can affect the performance of this operation.
Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available.
Fetch the next row of a query result set, returning a single sequence, or None when no more data is available. Alias for next().
Fetch the next row of a query result set, returning a single sequence, or None when no more data is available.
This read-only attribute specifies the number of rows that the last .execute*() produced (for DQL statements like SELECT) or affected (for DML statements like UPDATE or INSERT).
Not supported method.
Not supported method.
Bases: exceptions.Exception
Bases: exceptions.StandardError
Bases: exceptions.StandardError
Bases: object
Crate connection client using crate’s HTTP API.
Deletes the blob with given digest under the given table.
Returns true if the blob with the given digest exists under the given table.
Returns a file like object representing the contents of the blob with the given digest.
Stores the contents of the file like @data object in a blob under the given table and digest.
Default server to use if no servers are given on instantiation.
Retry interval for failed servers in seconds.
Execute SQL stmt against the crate server.
Crate URI path for issuing SQL statements.
Bases: unittest.case.TestCase
Bases: unittest.case.TestCase
Using a pool of 5 Threads to emit commands to the multiple servers through one Client-instance
check if number of servers in _inactive_servers and _active_servers always euqals the number of servers initially given.
Testing if lists of servers is handled correctly when client is used from multiple threads with some requests failing.
ATTENTION: this test is probabilistic and does not ensure that the client is indeed thread-safe in all cases, it can only show that it withstands this scenario.