emirozer/fake2db

name not taken in consideration for mysql

zaher-mh opened this issue · 3 comments

Name argument is not taken in consideration when creating mysql db.
None should replace by args.name here
https://github.com/emirozer/fake2db/blob/master/fake2db/fake2db.py#L161

Thank you for the report, i will take a look at this

bhrgu commented

Hi, all! My two cents is that the issue reported above is not specific only for mysql.
Name argument is used only if custom argument is presented, except postgresql.
I mean if statements in fakedb.main():

if args.name and args.custom:
    fake_sqlite_handler.fake2db_sqlite_initiator(args.rows,
                                                             args.name, args.custom)
elif args.custom:
    fake_sqlite_handler.fake2db_sqlite_initiator(args.rows, None, args.custom)
else:
    fake_sqlite_handler.fake2db_sqlite_initiator(args.rows)

BTW, it looks like a lack of logic, because name argument will be checked later in database_caller_creator methods and custom argument will checked in *initiator methods.

Maybe we need refactor this behavoir for calling all initiators the way it's implemented for postgresql?
https://github.com/emirozer/fake2db/blob/master/fake2db/fake2db.py#L179

That will make code simpler and avoid excessive conditional checks.

I just released version 0.5.4 to PyPi that contains this fix.