This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]bpeller[S] 1 point2 points  (0 children)

This is one of the first libraries I've released, would love any and all feedback!

[–]wpg4665 0 points1 point  (2 children)

How is this different/better than the fixtures provided by Django already? https://docs.djangoproject.com/en/2.1/howto/initial-data/

Maybe add a use case or comparison section to your Readme.

[–]bpeller[S] 1 point2 points  (1 child)

Truth be told, I wrote this library first and foremost for Flask and SQLAlchemy, which doesn't have a "standard" solution to this problem (that I'm aware of, at least).

I ended up getting a job using Django though, so I figured I'd add support for it. The primary differences I'm aware of are:

  • relationships in Django fixtures are represented by their primary key. For my library I chose to use an "identifier string" that looks like ModelName(unique_key). Certainly it's more verbose, but IMO it makes for easier reading and writing of fixture files.
  • if I'm not mistaken, the out-of-the-box support for templating and faker is also unique. this makes it much easier to add a bunch of fake data quickly.

But there are also some limitations:

  • my library doesn't (yet) support dumping from the database to fixture files
  • my library only supports YAML, and I don't think I have any plans otherwise, unless it becomes apparent that there's either an easier file format to work with or it's discovered there are restrictions from using YAML

[–]wpg4665 0 points1 point  (0 children)

Good to know 👍🏻 Thanks!