== Database Usage

IMPORT / EXPORT AEADs, to/from a database using yhsm-db-import and yhsm-db-export

=== INSTALLATION

On Debian/Ubuntu install
[source, sh]
~$ sudo apt-get install python-sqlalchemy (or any other method illustrated at: http://docs.sqlalchemy.org/en/rel_0_8/intro.html#installation)



On other systems:
Install SQLAlchemy from http://docs.sqlalchemy.org/en/rel_0_8/intro.html#installation


A database schema is provided to configure the database table for the
import/export tools. Create your favourite database and use te schema db_schema
provided.

[source, sh]
----
~$ cat doc/db_schema
CREATE TABLE aead_table (
  public_id varchar(16) NOT NULL,
  keyhandle INT NOT NULL,
  aead BLOB NOT NULL,
  PRIMARY KEY (public_id, keyhandle)
);
----


=== USAGE


IMPORT: yhsm-db-import aeads_source_folder database_url

EXPORT: yhsm-db-export aeads_destination_folder database_url

[CAUTION]
It is not safe to execute the command with the database url containing username
and password.


==== IMPORT
[source, sh]
~$ python yhsm-db-import /root/aeads/ mysql://localhost/database_name

OR

[source, sh]
~$ python yhsm-db-import /root/aeads/ mysql://root:password@localhost:3306/database_name


==== EXPORT
[source, sh]
~$ python yhsm-db-export /root/aeads/ mysql://localhost/database_name

OR

[source, sh]
~$ python yhsm-db-export /root/aeads/ mysql://root:password@localhost:3306/database_name

