Hacker Timesnew | past | comments | ask | show | jobs | submitlogin
Fake2db – Generate fake but valid data-filled databases (github.com/emirozer)
120 points by emirozer on Dec 17, 2014 | hide | past | favorite | 15 comments


Some time ago, I wrote a simple tool (command line and C++ library) for generating random data for the same purpose. You basically specify a regular expression and the random strings on output match that regexp. Link: https://github.com/vrok/randodo


Hi! Looks interesting. I usually use faker for this (https://github.com/joke2k/faker). How does fake2db compare to it?


Faker is python-specific, and not really about creating databases, but of course you can tack that on easily. It also gives you specific values instead of a set schema and supports different languages. I use faker too, and my favourite is to tack it on to factory_boy (http://factoryboy.readthedocs.org/en/latest/) for unit testing data with random but reasonable values.

Maybe a cool idea is to merge these two projects or use faker to do the value generation part here, but add more stuff in this project that's about generating a consistent schema of related values - fake users that post fake posts from fake locations in a consistent manner.

edit: Actually it looks like this does use faker!


Btw, they have counterparts in the Ruby world: https://github.com/stympy/faker (which states to be a port from Perl) and https://github.com/thoughtbot/factory_girl I use them in a Rails db/seed.rb file to create a new dev db every time I need new data to play with, especially after changes to the schema.


Oh, makes sense. I did not see that this is a bridge between DBs and faker. Mixer does something similar directly on top of sqlalchemy if I recall correctly.


Author here, I am a rather newcomer to OSS projects and development. Any criticism is highly appreciated. Have a beautiful day !


Nice utility. I submitted a pull request for FoundationDB SQL Layer https://github.com/emirozer/fake2db/pull/4


I'm starting to learn and use MongoDB quite a bit and this one thing I tend to struggle with is getting enough data into a DB to test and run queries on. I'll be happy to give this a go.


emirozer (the author), you're marked as [dead], which means that your comments are hidden by default and nobody can reply to you. Try emailing hn@ycombinator.com and see if a moderator can sort that out.


it would have been better if you can predefine DDLs.


It seems like this project is basically just fake-factory applied to a few different databases. It doesn't look that useful on its own, but it's a nice demo of those packages.


I think it's very handy, saves me from writing seeders for my projects


Using Faker with Fabrication is pretty swell as well. You'd already have Fabricators defined for your tests, so you just call the Fabricator however many time you need in your seed file and you're done.


Hellyeah gonna try this out!


+1




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: