Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Fetch singer-io tap codebase #4

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
11ae7a9
Fix ad_insights_country's primary key (#154)
luandy64 Jun 28, 2021
6d6da5f
Bump to v1.15.0, update changelog (#155)
luandy64 Jun 28, 2021
2c32048
Update streams list in README; fix typo (#156)
Jul 22, 2021
c2130b5
remove test pylint step (#159)
kspeer825 Aug 24, 2021
b8853e5
bump attrs to 17.3.0 (#161)
kspeer825 Sep 15, 2021
0aab1ab
Bump to v1.15.1, update changelog (#162)
luandy64 Sep 15, 2021
c33af77
Bump SDK to v12 (#164)
luandy64 Sep 20, 2021
1a510c1
Bump to v1.16.0, update changelog (#165)
luandy64 Sep 20, 2021
e981088
Parallelize CircleCI (#163)
luandy64 Sep 24, 2021
09e173b
Remove reference to shiphero (#166)
luandy64 Sep 24, 2021
10bad1c
Feature/retry insights job polling (#174)
dsprayberry Nov 2, 2021
1af73ac
Crest Work (#176)
hpatel41 Nov 19, 2021
1e55199
Bump Version 1.18.0 (#177)
KrisPersonal Nov 22, 2021
65aea9e
Update changelog.md (#178)
dsprayberry Nov 22, 2021
427232f
TDL-6148: Catch and retry Attribute error and TDL-13267: Fix AdCreati…
savan-chovatiya Nov 23, 2021
59e831c
Bump to version 1.18.1 (#179)
KrisPersonal Nov 29, 2021
8286e9b
TDL-15863: Implement Request Timeout (#173)
savan-chovatiya Dec 14, 2021
b678b9a
Bump version for Request Timeout (#181)
KrisPersonal Dec 15, 2021
b69c23c
move build time and notifications (#183)
kspeer825 Dec 21, 2021
01088cd
remove setuptools and pip upgrade (#185)
kspeer825 Feb 14, 2022
86a2cc4
Added test cases or attribution window (#189)
manand31 Apr 13, 2022
3318ad9
Qa/logging tap tester (#190)
kspeer825 Apr 22, 2022
ccf14ab
Bump to api version v13 (#191)
zachharris1 Jun 15, 2022
d5a6b31
save test logs, use tt logger (#196)
kspeer825 Aug 18, 2022
df379de
Qa/fix date range in tests (#199)
kspeer825 Sep 8, 2022
ecf46e5
Bump facebook API to v14.0 (#201)
shantanu73 Oct 20, 2022
29ea77e
Fix Changelog typos (#210)
dsprayberry Mar 8, 2023
5c62610
Upgrade facebook_business SDK to v16.0.2 (#213)
kethan1122 Apr 11, 2023
2456f70
Remove auto PyPI upload (#212)
luandy64 Apr 24, 2023
5381c8d
SDK bump, Version Bump, Changelog (#220)
dsprayberry Jun 26, 2023
8cef617
Add conversions to insights streams (#204)
GtheSheep Aug 16, 2023
9761160
setup and changelog update to add conversions to insights streams (#224)
sgandhi1311 Aug 16, 2023
a30c5b3
TDl-19503 (#225)
JYOTHINARAYANSETTY Aug 31, 2023
510eeb0
Add retry logic for status code - 503 (#226)
sgandhi1311 Sep 13, 2023
37274c3
Remove problem stream from applicable tests, fail test when associate…
bhtowles Oct 13, 2023
7a94090
Tdl 9685 (#227)
bhuvana-talend Oct 18, 2023
d9f361e
all_fields_test, update streams to test, move upsert method to missin…
bhtowles Oct 26, 2023
add18f1
Facebook test client WIP, campaigns stream only (#231)
bhtowles Nov 15, 2023
1482632
Upgrade python version to 3.11.7 (#237)
leslievandemark Jan 23, 2024
6aeb27e
SDK version upgrade to v19 (#238)
rdeshmukh15 Mar 6, 2024
534bded
Fix for summary param error - Added retry logic (#239)
sgandhi1311 Apr 15, 2024
2b69484
Enable copilot usage in PR template according to Qlik policy
eskaaren Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 195 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,240 @@
version: 2.1

orbs:
slack: circleci/slack@3.4.2

executors:
docker-executor:
docker:
- image: 218546966473.dkr.ecr.us-east-1.amazonaws.com/circle-ci:stitch-tap-tester

jobs:
build:
docker:
- image: 218546966473.dkr.ecr.us-east-1.amazonaws.com/circle-ci:tap-tester-v4
executor: docker-executor
steps:
- run: echo 'CI done'
ensure_env:
executor: docker-executor
steps:
- checkout
- run:
name: 'Setup virtual env'
name: 'Setup Virtual Env'
command: |
python3 -mvenv /usr/local/share/virtualenvs/tap-facebook
python3 -m venv /usr/local/share/virtualenvs/tap-facebook
source /usr/local/share/virtualenvs/tap-facebook/bin/activate
pip install -U pip setuptools
pip install .[dev]
- slack/notify-on-failure:
only_for_branches: master
- persist_to_workspace:
root: /usr/local/share/virtualenvs
paths:
- tap-facebook
run_pylint:
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: /usr/local/share/virtualenvs
- run:
name: 'pylint'
name: 'Run pylint'
command: |
source /usr/local/share/virtualenvs/tap-facebook/bin/activate
pylint tap_facebook -d C,R,W
- slack/notify-on-failure:
only_for_branches: master
run_unit_tests:
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: /usr/local/share/virtualenvs
- run:
when: always
name: 'Unit Tests'
name: 'Run Unit Tests'
command: |
source /usr/local/share/virtualenvs/tap-facebook/bin/activate
nosetests tests/unittests
- add_ssh_keys
- slack/notify-on-failure:
only_for_branches: master
run_integration_tests:
parameters:
test_name:
type: string
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: /usr/local/share/virtualenvs
- run:
name: 'Integration Tests'
name: 'Run Integration Tests'
command: |
aws s3 cp s3://com-stitchdata-dev-deployment-assets/environments/tap-tester/tap_tester_sandbox dev_env.sh
source dev_env.sh
source /usr/local/share/virtualenvs/tap-tester/bin/activate
run-test --tap=tap-facebook \
--target=target-stitch \
--orchestrator=stitch-orchestrator \
--email=harrison+sandboxtest@stitchdata.com \
--password=$SANDBOX_PASSWORD \
--client-id=50 \
tests

run-test --tap=tap-facebook tests/<< parameters.test_name >>
- slack/notify-on-failure:
only_for_branches: master
deploy:
executor: docker-executor
steps:
- checkout
- add_ssh_keys:
fingerprints:
- '18:3e:7f:b6:39:58:d3:0f:70:54:32:d6:3e:d7:13:4e'
- attach_workspace:
at: /usr/local/share/virtualenvs
- run: source /usr/local/share/virtualenvs/tap-facebook/bin/activate
- run:
name: 'pylint tests'
name: 'Create git tag'
command: |
source /usr/local/share/virtualenvs/tap-tester/bin/activate
pip install pylint
pylint tests/*.py -d 'broad-except,chained-comparison,empty-docstring,fixme,invalid-name,line-too-long,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-raise,no-else-return,too-few-public-methods,too-many-arguments,too-many-branches,too-many-lines,too-many-locals,ungrouped-imports,wrong-spelling-in-comment,wrong-spelling-in-docstring,duplicate-code,no-name-in-module,attribute-defined-outside-init,too-many-statements,cell-var-from-loop,too-many-public-methods,missing-docstring,use-a-generator'
version=$(python setup.py --version)
git config user.email "stitchintegrationdev@talend.com"
git config user.name "${CIRCLE_USERNAME}"
git tag -a v"${version}" -m "version ${version}"
git push --tags
- run:
name: 'Build and Upload'
command: |
pip install twine
python setup.py sdist --dist-dir dist
twine upload --username $PYPI_USERNAME --password $PYPI_PASSWORD ./dist/*
- slack/notify-on-failure:
only_for_branches: master
- slack/notify:
message: ':green_circle: A new version of the tap has been tagged and released'

workflows:
version: 2
commit:
jobs:
- ensure_env:
context: circleci-user
- run_pylint:
context: circleci-user
requires:
- ensure_env
- run_unit_tests:
context: circleci-user
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_start_date.py"
test_name: "test_facebook_start_date.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_field_selection.py"
test_name: "test_facebook_field_selection.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_discovery.py"
test_name: "test_facebook_discovery.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_bookmarks.py"
test_name: "test_facebook_bookmarks.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_automatic_fields.py"
test_name: "test_facebook_automatic_fields.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_tests_run.py"
test_name: "test_facebook_tests_run.py"
requires:
- ensure_env
- build:
context: circleci-user
requires:
- run_pylint
- run_unit_tests
- test_facebook_start_date.py
- test_facebook_field_selection.py
- test_facebook_discovery.py
- test_facebook_bookmarks.py
- test_facebook_automatic_fields.py
- test_facebook_tests_run.py
- deploy:
context: circleci-user
requires:
- build
filters:
branches:
only: master
build_daily:
jobs:
- ensure_env:
context: circleci-user
- run_pylint:
context: circleci-user
requires:
- ensure_env
- run_unit_tests:
context: circleci-user
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_start_date.py"
test_name: "test_facebook_start_date.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_field_selection.py"
test_name: "test_facebook_field_selection.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_discovery.py"
test_name: "test_facebook_discovery.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_bookmarks.py"
test_name: "test_facebook_bookmarks.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_automatic_fields.py"
test_name: "test_facebook_automatic_fields.py"
requires:
- ensure_env
- run_integration_tests:
context: circleci-user
name: "test_facebook_tests_run.py"
test_name: "test_facebook_tests_run.py"
requires:
- ensure_env
- build:
context: circleci-user
requires:
- run_pylint
- run_unit_tests
- test_facebook_start_date.py
- test_facebook_field_selection.py
- test_facebook_discovery.py
- test_facebook_bookmarks.py
- test_facebook_automatic_fields.py
- test_facebook_tests_run.py
triggers:
- schedule:
cron: "0 6 * * *"
filters:
branches:
only:
- master
jobs:
- build:
context: circleci-user
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
# Changelog

# 1.14.0
## 1.16.0
* Bump tap dependency, `facebook_business`, from `10.0.0` to `12.0.0` [#164](https://github.com/singer-io/tap-facebook/pull/164)

## 1.15.1
* Bump tap dependency, `attrs`, from `16.3.0` to `17.3.0` [#161](https://github.com/singer-io/tap-facebook/pull/161)

## 1.15.0
* Add `country` to `ad_insights_country`'s composite primary key [#154](https://github.com/singer-io/tap-facebook/pull/154)

## 1.14.0
* Add an Ads Insight Stream, broken down by `hourly_stats_aggregated_by_advertiser_time_zone` [#151](https://github.com/singer-io/tap-facebook/pull/151)

# 1.13.0
## 1.13.0
* Bump API version from `v9` to `v10` [#146](https://github.com/singer-io/tap-facebook/pull/146)
* Add feature for AdsInsights stream: The tap will shift the start date to 37 months ago in order to fetch data from this API
* More info [here](https://www.facebook.com/business/help/1695754927158071?id=354406972049255)

# 1.12.1
## 1.12.1
* Increased insights job timeout to 300 seconds [#148](https://github.com/singer-io/tap-facebook/pull/148)

# 1.12.0
## 1.12.0
* Added leads stream [#143](https://github.com/singer-io/tap-facebook/pull/143)

# 1.11.2
## 1.11.2
* Added unique_outbound_clicks to several streams [#138](https://github.com/singer-io/tap-facebook/pull/138)

## 1.11.1
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ This is a [Singer](https://singer.io) tap that produces JSON-formatted data foll

This tap:
- Pulls raw data from the [Facebook Marketing API](https://developers.facebook.com/docs/marketing-apis)
- Extracts the following resources from Facebook for a one Ad account:
- Extracts the following resources from Facebook for one Ad account:
- Ad Creatives
- Ads
- Ad Sets
- Campaigns
- Leads
- Ads Insights
- Breakdown by age and gender
- Breakdown by country
- Breakdown by placement and device
- Breakdown by region
- Breakdown by the hour for advertisers
- Outputs the schema for each resource
- Incrementally pulls data based on the input state

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from setuptools import setup

setup(name='tap-facebook',
version='1.14.0',
version='1.16.0',
description='Singer.io tap for extracting data from the Facebook Ads API',
author='Stitch',
url='https://singer.io',
classifiers=['Programming Language :: Python :: 3 :: Only'],
py_modules=['tap_facebook'],
install_requires=[
'attrs==16.3.0',
'attrs==17.3.0',
'backoff==1.8.0',
'pendulum==1.2.0',
'facebook_business==10.0.0',
'facebook_business==12.0.0',
'requests==2.20.0',
'singer-python==5.10.0',
],
Expand Down
3 changes: 2 additions & 1 deletion tap_facebook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ def __iter__(self):
'ads_insights': {"breakdowns": []},
'ads_insights_age_and_gender': {"breakdowns": ['age', 'gender'],
"primary-keys": ['age', 'gender']},
'ads_insights_country': {"breakdowns": ['country']},
'ads_insights_country': {"breakdowns": ['country'],
"primary-keys": ['country']},
'ads_insights_platform_and_device': {"breakdowns": ['publisher_platform',
'platform_position', 'impression_device'],
"primary-keys": ['publisher_platform',
Expand Down
4 changes: 2 additions & 2 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def expected_metadata(self):
self.REPLICATION_METHOD: self.INCREMENTAL,
self.REPLICATION_KEYS: {"date_start"}
},
"ads_insights_country": { # TODO | add country | https://stitchdata.atlassian.net/browse/SRCE-2555
self.PRIMARY_KEYS: {"campaign_id", "adset_id", "ad_id", "date_start"}, # , "country"},
"ads_insights_country": {
self.PRIMARY_KEYS: {"campaign_id", "adset_id", "ad_id", "date_start", "country"},
self.REPLICATION_METHOD: self.INCREMENTAL,
self.REPLICATION_KEYS: {"date_start"}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_facebook_field_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def expected_pks():
"campaigns" : {"id"},
"ads_insights" : {"campaign_id", "adset_id", "ad_id", "date_start"},
"ads_insights_age_and_gender" : {"campaign_id", "adset_id", "ad_id", "date_start", "age", "gender"},
"ads_insights_country" : {"campaign_id", "adset_id", "ad_id", "date_start"},
"ads_insights_country" : {"campaign_id", "adset_id", "ad_id", "date_start", "country"},
"ads_insights_platform_and_device": {"campaign_id", "adset_id", "ad_id", "date_start", "publisher_platform", "platform_position", "impression_device"},
"ads_insights_region" : {"campaign_id", "adset_id", "ad_id", "date_start"},
"ads_insights_dma" : {"campaign_id", "adset_id", "ad_id", "date_start"},
Expand Down
Loading