Esempio n. 1
0
def main(config_filepath, section_name):
    file_name = config_filepath
    section_name = section_name

    query_create_db = "create database yelp"

    a = SqlClient(file_name, section_name)

    try:
        to_database = False
        a.connect(to_database=to_database)
        a.execute(query_create_db)
        a.close_connection()

    except Exception as e:
        print('Unable to create database')
def main(sql_schema_filepath, config_filepath, section_name):
    file_name = config_filepath
    section_name = section_name

    with open(sql_schema_filepath, 'r') as file:
        query_schema = file.read().replace('\n', '')

    a = SqlClient(file_name, section_name)

    try:
        to_database = True
        a.connect(to_database=to_database)

    except Exception as e:
        print('Unable to connect to database')

    a.execute(query_schema)
    a.close_connection()