Skip to content

Add migration to populate locations from Yelp#48

Merged
mtemnogorod merged 2 commits intodevelopfrom
yelp-data
May 9, 2023
Merged

Add migration to populate locations from Yelp#48
mtemnogorod merged 2 commits intodevelopfrom
yelp-data

Conversation

@mtemnogorod
Copy link
Copy Markdown
Collaborator

Overview

Add a migration to fetch business info from Yelp's API and use it to populate the api_location table

Closes #22

Demo

root@12eb698a8e54:/usr/local/src# python manage.py migrate api 0003
Operations to perform:
  Target specific migration: 0003_populate_locations, from api
Running migrations:
  Applying api.0003_populate_locations... OK
THIRDPLACES=# select * from api_location;
 id  |                      location                      |                 name                 |                      address            
           | price_category |       created_datetime        |       modified_datetime       | location_type_id 
-----+----------------------------------------------------+--------------------------------------+-----------------------------------------
-----------+----------------+-------------------------------+-------------------------------+------------------
  85 | 0101000020E610000076C3B64599F943400A2E56D460CA52C0 | Barbuzzo                             | 110 S 13th St Philadelphia, PA 19107    
           | $$             | 2023-05-09 21:24:27.258247+00 | 2023-05-09 21:24:27.258269+00 |                5
  86 | 0101000020E61000004B02D4D4B2F9434062A1D634EFCA52C0 | The Love                             | 130 S 18th St Philadelphia, PA 19103    
           | $$$            | 2023-05-09 21:24:27.27028+00  | 2023-05-09 21:24:27.270294+00 |                5
  87 | 0101000020E610000043CE0D0F8FF94340C69D13A35ECA52C0 | Double Knot                          | 120 S 13th St Philadelphia, PA 19107    
           | $$$            | 2023-05-09 21:24:27.271541+00 | 2023-05-09 21:24:27.271554+00 |                5
  88 | 0101000020E61000003DD52137C3F94340022B8716D9CA52C0 | Gran Caffe L'Aquila                  | 1716 Chestnut St Philadelphia, PA 19103 
           | $$             | 2023-05-09 21:24:27.27244+00  | 2023-05-09 21:24:27.272451+00 |                5
  89 | 0101000020E6100000F6F5D786E5F94340DA8F1491E1CA52C0 | Harper's Garden                      | 31 S 18th St Philadelphia, PA 19103     
           | $$             | 2023-05-09 21:24:27.273301+00 | 2023-05-09 21:24:27.273312+00 |                5
  90 | 0101000020E6100000BE2EC37FBAF943404CE141B3EBCA52C0 | The Dandelion                        | 124 S 18th St Philadelphia, PA 19103    
           | $$             | 2023-05-09 21:24:27.274069+00 | 2023-05-09 21:24:27.274079+00 |                5
  91 | 0101000020E610000019027F3E8AF9434043D1DCC760CA52C0 | Sampan                               | 124 S 13th St Philadelphia, PA 19107    

Testing instructions

Log into container terminal: docker exec -it third-places-django-1 bash
and run the new migration: python manage.py migrate api 0003

  • Migration runs successfully
  • api_location table contains new entries from Yelp

Checklist before merge

  • Update the CHANGELOG.md
  • Rebase your changes from whatever branch you're merging to

@mtemnogorod mtemnogorod requested a review from travissouthard May 9, 2023 21:31
Copy link
Copy Markdown
Collaborator

@travissouthard travissouthard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a fixup commit to limit just to cafes and fix the latitude and longitude in the point assignment

@mtemnogorod mtemnogorod merged commit 27f18f2 into develop May 9, 2023
@travissouthard travissouthard deleted the yelp-data branch May 10, 2023 00:03
@themightychris themightychris mentioned this pull request May 10, 2023
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

Successfully merging this pull request may close these issues.

Create a process to download and import location & review data

2 participants