def test_sqlite2mysql_function(self):

        from fundamentals.mysql import sqlite2mysql
        this = sqlite2mysql(log=log,
                            settings=settings,
                            pathToSqlite=pathToSqlite,
                            tablePrefix="Marvin")
        this.convert_sqlite_to_mysql()
    def test_sqlite2mysql_function(self):

        from fundamentals.mysql import sqlite2mysql
        this = sqlite2mysql(
            log=log,
            settings=settings,
            pathToSqlite=pathToSqlite,
            tablePrefix="Marvin"
        )
        this.convert_sqlite_to_mysql()
示例#3
0
    def test_sqlite2mysql_function_exception(self):

        from fundamentals.mysql import sqlite2mysql
        try:
            this = sqlite2mysql(log=log,
                                settings=settings,
                                pathToSqlite=pathToSqlite,
                                fakeKey="break the code")
            this.get()
            assert False
        except Exception as e:
            assert True
    def test_sqlite2mysql_function_exception(self):

        from fundamentals.mysql import sqlite2mysql
        try:
            this = sqlite2mysql(
                log=log,
                settings=settings,
                pathToSqlite=pathToSqlite,
                fakeKey="break the code"
            )
            this.get()
            assert False
        except Exception, e:
            assert True
            print str(e)
def main(arguments=None):
    """
    The main function used when ``yaml_to_database.py`` when installed as a cl tool
    """

    # setup the command-line util settings
    su = tools(
        arguments=arguments,
        docString=__doc__,
        logLevel="WARNING",
        options_first=False,
        projectName=False
    )
    arguments, settings, log, dbConn = su.setup()

    # unpack remaining cl arguments using `exec` to setup the variable names
    # automatically
    for arg, val in arguments.iteritems():
        if arg[0] == "-":
            varname = arg.replace("-", "") + "Flag"
        else:
            varname = arg.replace("<", "").replace(">", "")
        if isinstance(val, str) or isinstance(val, unicode):
            exec(varname + " = '%s'" % (val,))
        else:
            exec(varname + " = %s" % (val,))
        if arg == "--dbConn":
            dbConn = val
        log.debug('%s = %s' % (varname, val,))

    from fundamentals.mysql import sqlite2mysql
    converter = sqlite2mysql(
        log=log,
        settings=settings,
        pathToSqlite=pathToSqliteDB,
        tablePrefix=tablePrefix,
        dbConn=dbConn
    )
    converter.convert_sqlite_to_mysql()

    return
示例#6
0
def main(arguments=None):
    """
    The main function used when ``yaml_to_database.py`` when installed as a cl tool
    """

    # setup the command-line util settings
    su = tools(arguments=arguments,
               docString=__doc__,
               logLevel="WARNING",
               options_first=False,
               projectName=False)
    arguments, settings, log, dbConn = su.setup()

    # unpack remaining cl arguments using `exec` to setup the variable names
    # automatically
    for arg, val in list(arguments.items()):
        if arg[0] == "-":
            varname = arg.replace("-", "") + "Flag"
        else:
            varname = arg.replace("<", "").replace(">", "")
        if isinstance(val, str):
            exec(varname + " = '%s'" % (val, ))
        else:
            exec(varname + " = %s" % (val, ))
        if arg == "--dbConn":
            dbConn = val
        log.debug('%s = %s' % (
            varname,
            val,
        ))

    from fundamentals.mysql import sqlite2mysql
    converter = sqlite2mysql(log=log,
                             settings=settings,
                             pathToSqlite=pathToSqliteDB,
                             tablePrefix=tablePrefix,
                             dbConn=dbConn)
    converter.convert_sqlite_to_mysql()

    return