Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple columns with same faker key OR allow column naming #50

Open
denitsa-md opened this issue Dec 27, 2019 · 0 comments
Open

Comments

@denitsa-md
Copy link

I found myself needing to do the following to replicate a table structure:

fake2db --rows 1500 --db mysql --name=test_speed --username root --password secret --custom date_time_this_year random_digit_not_null random_digit_not_null uuid4 word boolean boolean boolean random_number random_number word last_name word word word word last_name year

Then I found out that I couldn't use duplicate faker keys for my columns, so using random_digit_not_null twice is not possible.

I wrote some code in the mysql handler to append keys to the columns in order to allow duplicates (see this commit denitsa-md@73df919)

I do think the mysql_handler is probably not the best place for this -> the unique columns should somehow be formatted further up and passed to all handlers. But it's the first time I'm touching python so I just hacked it a bit for my purposes.

Then the command above would result in a table structure like this:

image

Would be nice if something like this was supported out of the box for all database engines. Or perhaps even better, the option to name the columns in addition to providing the faker keys. This would alleviate the issue altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant