Giter Site home page Giter Site logo

facebook_to_db's Introduction

Ingesting Data from Facebook Marketing API into a MySQL Database using the Python SDK

2019-09-19 created methods to batch requests into smaller date ranges; has improved overall performance and logging

  • AdSetsTable created

  • To do: create CountryTable, create AdsCreativeTable, create AdsMetaTable, create AdsCreativeMetricsTable

  • 2019-09-13: project has been made into a package. Added tables:

  • AdsInsightsAgeGenderTable

  • AdsInsightsRegion Table note: project ready to scale to include more accounts

2019-09-05: created models.py module where the database is to be engineered. Added tables:

  • AccountsTable
  • CampaignsTable
  • AdsInsightsTable

Introduction

This script was written using Python 3.7.3. To make sure you are using the correct version to execute the script add the following lines of code to the .py file:

import sys
print(sys.version)

Or simply python --version in the console.

Python Main Prerequisites

To load requirements enter:

pip install -r requirements.txt

Set up for Usage

You must have access to an existing mySQL database. Refer to https://docs.sqlalchemy.org/en/13/core/engines.html for engine configuration with SQLAlchemy. The syntax for the database Url is dialect+driver://username:password@host:port/database . I used PyMySQL as the preffered driver.

Next, execute the following in terminal:

mkdir staging; mkdir settings;
touch db_secrets.json; touch fb_client_secrets.json

The json files located in the settings directory should be filled your personal credentials in the following format:

  1. db_secrets.json:
{
    "hostname": "<YOUR HOST NAME>"
    "user": " <YOUR USER NAME>"
    "password": "<YOUR PASSWORD>"
}
  1. fb_client_secrets.json:
{
    "my_app_id: "<APP ID>"
    "my_app_secret": "<APP SECRET>"
    "my_access_token": "<ACCESS TOKEN>"
}

facebook_to_db's People

Contributors

derekwayne avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.