def get_database(model_name, return_keyword=False):
    engine = db_connect("databases", model_name=model_name)
    Session = sessionmaker(bind=engine)
    session = Session()
    doc = "select * from documents"
    auth = "select * from authors"
    Author = toDataFrame(auth, session)
    Author.index = Author.id
    Document = toDataFrame(doc, session)
    Document.index = Document.id

    Key_Auth = '''
    select authors_id, keywords_id, keyword, first_name, last_name
    from keywords k, documents_keywords dk, documents_authors da, authors a, documents d
    where a.id = da.authors_id and d.id = da.documents_id and d.id = dk.documents_id and k.id = dk.keywords_id
    '''

    Key_Auth_alt = '''
    select authors_id, keywords_id, keyword, first_name, last_name
    from keywords k, documents_keywords dk, documents_authors da, authors a, documents d
    where a.id = da.authors_id and d.id = da.documents_id and d.id = dk.documents_id and k.id = dk.keywords_id
    '''
    tmpt = session.execute(Key_Auth)
    KA = DataFrame(tmpt.fetchall(), columns=list(tmpt.keys()))

    Docu_Auth = '''
    select authors_id, documents_id, first_name, last_name, title
    from authors a, documents b, documents_authors c
    where a.id=c.authors_id and c.documents_id=b.id;
    '''

    tmpt = session.execute(Docu_Auth)
    DA = DataFrame(tmpt.fetchall(), columns=list(tmpt.keys()))

    Key_Freq = '''
    select keywords.id, keyword, freqency
    from (select keywords_id, count(*) freqency from documents_keywords group by keywords_id) a, keywords
    where keywords.id = a.keywords_id
    '''
    a = session.execute(Key_Freq)
    Keyword = DataFrame(a.fetchall(), columns=list(a.keys()))
    Keyword.index = Keyword.id

    DocNum = session.execute('select count(*) from documents').first()[0]
    Keyword.loc[:, 'weight'] = np.log(DocNum / Keyword.freqency)
    if not return_keyword:
        return Author, Document, KA, DA
    else:
        return Author, Document, KA, DA, Keyword