-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Seed the database #73
Comments
@yenhtran had some progress with this - but basically we found out that a simple |
Found some docs on this - https://github.com/CodeWithAloha/uipa/blob/d9e5322e0ed21b680f0e597997c20274f670220e/docs/importpublicbodies.rst, going to give it a shot this Wednesday. |
Isn't this:
the same as Froide's Docs on Importing Public Bodies? Both suggest using the Google spreadsheet linked in the docs to create a CSV file and load it using I restored a backup of my notes on UIPA development from 2018 and have been trying to recreate a development version of the UIPA website by loading the seed data from the |
I was able to:
|
Notes on where we left off: However we are noticing only 28 got uploaded. We get the following error when we run the command: When comparing Was reviewing this chunk of code: https://github.com/CodeWithAloha/froide/blob/5584e46107fce5ffee409a2172d07974d9e9103e/froide/publicbody/models.py#L360 cc: @tyliec |
One of the problems with loading the database from the JSON fixture files is the files were dumped from a database that has data in related tables. So, I wrote a Python program to extract the data from the publicbody.publicbody.json fixture file and create a CSV file to load from the Admin site or using I just got through loading these tables and dumping the data into JSON fixture files:
I'm using the names from the Public Body administration page in the Admin site to refer to these tables. I was also looking in the old UIPA codebase and saw these CSV files in the data folder: I think it might be a good idea to use 2017-11-21-Hawaii_UIPA_Public_Bodies_All.csv as it is probably the most recent in terms of data used for the go-live of UIPA.org. I'm going to redo my data load to use this file. |
As a side note, the old UIPA.org development used a SQLite database. I'm going to assume that using PostgreSQL for development is currently the preferred method. Thus, I created a |
Thank you @russtoku for the explain. Any chance you'd be able to push up your changes? We are still stuck... |
Shall I make a pull request to add a seed folder under the Can you tell me what repo, branch, and commit you're using? The main branch of https://github.com/CodeWithAloha/uipa before March 6, 2024 was renamed to main-copy and a new main branch was created. |
@russtoku - I think a pull request would be super helpful. So the repo/branch/commit I'm using is sort of complicated but I had been working off the |
Great! You are working at the point that I was when I was able to load public bodies as mentioned above in my #73 (comment). I will make a pull request (PR) against the |
Yay! Mahalo @russtoku !🤙 |
In regards to @yenhtran 's comment:
The difference is |
See #80 for a first pass at seeding the database for development. |
I think when we were still debugging this, we did notice that up until pk:29 all the |
Objective
To implement support for seeding the database.
Context
Some of us have gotten the UIPA portal running, however it looks a little weird with zero data. For the purposes of development, it is quite helpful to have an initial seeding of data present to allow for all the normal operations of the portal locally.
This capability was present in the previous iteration of the UIPA portal in the
reset.sh
script.Tasks
Success Criteria
The ability to seed the database is available, for both public bodies and requests.
Related Items
Parent Epic: #50
loaddata
command: https://docs.djangoproject.com/en/5.0/ref/django-admin/#loaddataimport_csv
command runs: https://github.com/CodeWithAloha/uipa/blob/main/froide/publicbody/csv_import.pyOpen Questions:
The text was updated successfully, but these errors were encountered: