innoldb package¶
Subpackages¶
Submodules¶
innoldb.main module¶
- class innoldb.main.KeyValue(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶
Bases:
argparse.Action
- innoldb.main.do_program(cli_args)¶
- innoldb.main.entrypoint()¶
- innoldb.main.find(table, fields)¶
- innoldb.main.get_all(table)¶
- innoldb.main.history(table, id)¶
- innoldb.main.insert(table, document)¶
- innoldb.main.load(id, table)¶
- innoldb.main.mock(table)¶
- innoldb.main.update_prop(document, **props)¶
innoldb.qldb module¶
- class innoldb.qldb.Document(table, id=None, snapshot=None, ledger=None, no_index=False)¶
Bases:
innoldb.qldb.LedgerA innoldab.qldb.Document object, representing an entry in an QLDB Ledger Table. Creates an instance of innoldb.qldb.Document. This object can be initialized in several states, depending on the parameters passed into the constructor.
Constructor Arguments: table
Constructor Arguments: table, id
Constructor Arguments: table, snapshot
Constructor Arguments: table, no_index
Constructor Arguments: table, no_index, snapshot
- Parameters
table (str) – Name of the **QLDB**table
id (str, optional) – Id of the document to load, defaults to None
snapshot (dict, optional) – dict containing values to map to attributes, defaults to None
ledger (str, optional) – Name of the QLDB ledger, defaults to innoldb.settings.LEDGER
no_index – flag to signal document has no index, defaults to False
no_index – bool, optional
- fields()¶
All of the innoldb.qldb.Document fields as a key-value dict. Hides the document attributes table, driver, index and ledger, if an object containing only the relevant fields.
- Returns
innoldb.qldb.Document fields
- Return type
dict
- save()¶
Save the current value of the innoldb.qldb.Document fields to the QLDB ledger table.
- class innoldb.qldb.Ledger(table, ledger=None)¶
Bases:
objectA class containing meta information associated with QLDB ledger.
- class innoldb.qldb.Query(table, ledger=None)¶
Bases:
innoldb.qldb.LedgerObject that represents a PartiQL query. Get initialized on a particular table and ledger. Methods will return results formatted as collections of innoldb.qldb.Document.
- find_by(**kwargs)¶
Filter innoldb.qldb.Document objects by the provided fields. This method accepts **kwargs arguments for the field name and values. The document fields must exactly match the fields provided in the query.
- Parameters
kwargs – Fields by which to filter the query.
- Returns
List of innoldb.qldb.Document
- Return type
list
- find_in(**kwargs)¶
Filter innoldb.qldb.Document objects by the provided fields. This method accepts **kwargs arguments for the field name and values, but the values must be an array. The document fields must belong to the array associated with the field in the **kwargs. See below for example
- Parameters
kwargs – Fields by which to filter the query.
- Returns
List of innoldb.qldb.Document
- Return type
list
Note
Example
`python Query('table').find_in(**{'field': [12, 13, 14], 'field2': ['cat', 'dog' ]}) `will find all documents with a field whose value is in the set (12, 13, 14) and a field2 whose value is in the set (‘cat’, ‘dog’)
- get_all()¶
Return all innoldb.qldb.Document objects in the QLDB ledger table
- Returns
List of innoldb.qldb.Document
- Return type
list
- history(id=None)¶
- raw(query)¶
- class innoldb.qldb.Strut(**kwargs)¶
Bases:
objectSimple object to parse innoldb.qldb.Document. Used to deserialize QLDB responses into Python native objects, with attributes accessible through object properties, i.e., the document ```json {
- ‘a’: {
- ‘b’{
‘c’ : ‘d’
}
}
gets parsed into an object, such that
`python object.a.b.c == 'd' `
innoldb.settings module¶
- innoldb.settings.get_log_level()¶