asedb_sqlite3_backend package

Submodules

asedb_sqlite3_backend.asedb_sqlite3_backend module

class asedb_sqlite3_backend.asedb_sqlite3_backend.ASEdbSQlite3Backend(database=None, user=None, password=None, remote=None)[source]

Bases: abcd.backend.Backend

class Cursor(iterator)[source]

Bases: abcd.backend.Cursor

count()[source]
next()[source]
ASEdbSQlite3Backend.add_keys(*args, **kwargs)[source]
ASEdbSQlite3Backend.authenticate(credentials)[source]
ASEdbSQlite3Backend.close()[source]
ASEdbSQlite3Backend.connect_to_database()[source]

Connnects to a database with given name. If it doesn’t exist, a new one is created. The method first looks in the “write” folder, and then in the “readonly” folder

ASEdbSQlite3Backend.find(*args, **kwargs)[source]
ASEdbSQlite3Backend.insert(*args, **kwargs)[source]
ASEdbSQlite3Backend.is_open()[source]
ASEdbSQlite3Backend.list(auth_token)[source]
ASEdbSQlite3Backend.open()[source]
ASEdbSQlite3Backend.read_only(func)[source]
ASEdbSQlite3Backend.remove(*args, **kwargs)[source]
ASEdbSQlite3Backend.remove_keys(*args, **kwargs)[source]
ASEdbSQlite3Backend.require_database(func)[source]

When a function is decorated with this, an error will be thrown if the connection to a database is not open.

ASEdbSQlite3Backend.update(*args, **kwargs)[source]
asedb_sqlite3_backend.asedb_sqlite3_backend.row2atoms(row, keys, omit_keys)[source]

keys: keys to show. None for all omit_keys: if true, all keys not in “keys” will be shown

asedb_sqlite3_backend.mongodb2asedb module

asedb_sqlite3_backend.mongodb2asedb.interpret(key, op, val)[source]

Returns a list of ASEdb queries, where elements in this list are assumed to be ORed.

asedb_sqlite3_backend.mongodb2asedb.translate_query(query)[source]

Translates the MongoDB query to the ASEdb query

asedb_sqlite3_backend.remote module

Functions that are used to communicate with a remote server (server.py).

asedb_sqlite3_backend.remote.communicate_with_remote(host, command)[source]

Sends a command to the remote host and interprets and returns the response.

asedb_sqlite3_backend.remote.result_from_dct(result_type, **kwargs)[source]

Re-creates a result that was converted to a dictionary.

asedb_sqlite3_backend.server module

Interface for the ASEdb backend. Its purpose is to be triggered by the communicate_with_remote function from remote.py, communicate with the ASEdb backend and print results/data to standard output. The output is b64-encoded and should be in a form XYZ:OUTPUT, where XYZ is the response code which indicates what type of output was produced (see below).

Response codes: 201: b64encoded string 202: json and b64encoded list 203: json and b64encoded dictionary 204: json and b64encoded list of dictionaries 220: json and b64encoded InsertResult dictionary 221: json and b64encoded UpdateResult dictionary 222: json and b64encoded RemoveResult dictionary 223: json and b64encoded AddKvpResult dictionary 224: json and b64encoded RemoveKeysResult dictionary 400: b64encoded string - Error 401: b64encoded string - ReadError 402: b64encoded string - WriteError

asedb_sqlite3_backend.server.backendAddKeys(*args, **kwargs)[source]
asedb_sqlite3_backend.server.backendFind(*args, **kwargs)[source]
asedb_sqlite3_backend.server.backendInsert(*args, **kwargs)[source]
asedb_sqlite3_backend.server.backendList(*args, **kwargs)[source]
asedb_sqlite3_backend.server.backendRemove(*args, **kwargs)[source]
asedb_sqlite3_backend.server.backendRemoveKeys(*args, **kwargs)[source]
asedb_sqlite3_backend.server.backendUpdate(*args, **kwargs)[source]
asedb_sqlite3_backend.server.error_handler(func)[source]
asedb_sqlite3_backend.server.main()[source]

asedb_sqlite3_backend.util module

asedb_sqlite3_backend.util.add_user(user)[source]

Adds a user and their public key to ~/.ssh/authorized_keys file and creates directories $databases/USER and $databases/USER_readonly.

asedb_sqlite3_backend.util.get_dbs_path()[source]

Reads the config file and returns the path to the folder where all the databases are stored.

asedb_sqlite3_backend.util.main()[source]
asedb_sqlite3_backend.util.print_usage()[source]
asedb_sqlite3_backend.util.setup()[source]

Create a config file and a directory in which databases will be stored.