def init_library_db(library_db):
    """initializes the library database"""
    from src.praxxis.sqlite import connection
    conn = connection.create_connection(library_db)
    cur = conn.cursor()
    create_metadata_table = (
        'CREATE TABLE "LibraryMetadata" (Path TEXT PRIMARY KEY, Readme TEXT, Library TEXT, Remote TEXT) '
        )
    create_notebook_table = (
        'CREATE TABLE "Notebooks" (Path TEXT PRIMARY KEY, Notebook TEXT, Library TEXT, RawUrl TEXT, FOREIGN KEY(Library) REFERENCES "LibraryMetadata"(Library)) '
        )
    create_parameter_table = (
        'CREATE TABLE "Parameters" (Parameter TEXT PRIMARY KEY, Value TEXT)')
    create_notebook_parameter_table = (
        'CREATE TABLE "NotebookDefaultParam" (Parameter TEXT, Value TEXT, Notebook TEXT, Library TEXT,  PRIMARY KEY(Parameter, Library, Notebook), FOREIGN KEY(Notebook) REFERENCES "Notebooks"(Notebook), FOREIGN KEY(Parameter) REFERENCES "Parameters"(Parameter), FOREIGN KEY(Library) REFERENCES "Library"(Library)) '
        )
    cur.execute(create_metadata_table)
    cur.execute(create_notebook_table)
    cur.execute(create_parameter_table)
    cur.execute(create_notebook_parameter_table)
    conn.commit()
    conn.close()
