# salt.sdb.sqlite3

SQLite sdb Module

maintainer:

  SaltStack

maturity:

  New

platform:

  all

This module allows access to sqlite3 using an `sdb://` URI

Like all sdb modules, the sqlite3 module requires a configuration profile to be configured in either the minion or master configuration file. This profile requires very little. For example:

    mysqlite:
      driver: sqlite3
      database: /tmp/sdb.sqlite
      table: sdb
      create_table: True

The `driver` refers to the sqlite3 module, `database` refers to the sqlite3 database file. `table` is the table within the db that will hold keys and values (defaults to `sdb`). The database and table will be created if they do not exist.

## Advanced Usage:

Instead of a table name, it is possible to provide custom SQL statements to create the table(s) and get and set values.

    myadvanced
      driver: sqlite3
      database: /tmp/sdb-advanced.sqlite
    create_statements:
      - "CREATE TABLE advanced (a text, b text, c blob, d blob)"
      - "CREATE INDEX myidx ON advanced (a)"
    get_query: "SELECT d FROM advanced WHERE a=:key"
    set_query: "INSERT OR REPLACE INTO advanced (a, d) VALUES (:key, :value)"

salt.sdb.sqlite3.get(key, profile=None)

  Get a value from sqlite3

salt.sdb.sqlite3.set_(key, value, profile=None)

  Set a key/value pair in sqlite3