logos-sdk 0.0.25.dev13__tar.gz → 0.0.25.dev15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/PKG-INFO +3 -2
  2. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/big_query/BigQuery.py +50 -0
  3. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/MicrosoftAdvertising.py +38 -0
  4. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk.egg-info/PKG-INFO +3 -2
  5. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/LICENSE +0 -0
  6. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/README.md +0 -0
  7. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/__init__.py +0 -0
  8. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/big_query/__init__.py +0 -0
  9. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/logging/LogosLogger.py +0 -0
  10. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/logging/__init__.py +0 -0
  11. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/CampaignManager.py +0 -0
  12. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/Collabim.py +0 -0
  13. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/DV360.py +0 -0
  14. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/Facebook.py +0 -0
  15. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/GoogleAds.py +0 -0
  16. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/GoogleSheets.py +0 -0
  17. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/MarketMiner.py +0 -0
  18. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/MerchantCenter.py +0 -0
  19. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/Sklik.py +0 -0
  20. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk/services/__init__.py +0 -0
  21. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk.egg-info/SOURCES.txt +0 -0
  22. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk.egg-info/dependency_links.txt +0 -0
  23. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk.egg-info/requires.txt +0 -0
  24. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/logos_sdk.egg-info/top_level.txt +0 -0
  25. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/setup.cfg +0 -0
  26. {logos_sdk-0.0.25.dev13 → logos_sdk-0.0.25.dev15}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: logos-sdk
3
- Version: 0.0.25.dev13
3
+ Version: 0.0.25.dev15
4
4
  Summary: SDK for Logos platform
5
5
  Home-page: https://bitbucket.org/databy/logos-sdk-pip/src/master/
6
6
  Author: Databy.io
@@ -25,6 +25,7 @@ Dynamic: classifier
25
25
  Dynamic: description
26
26
  Dynamic: description-content-type
27
27
  Dynamic: home-page
28
+ Dynamic: license-file
28
29
  Dynamic: requires-dist
29
30
  Dynamic: summary
30
31
 
@@ -88,6 +88,27 @@ class BigQuery:
88
88
 
89
89
  self._insert_into_table(bq_table, records)
90
90
 
91
+ def insert_create_partitioned_table(
92
+ self,
93
+ dataset_id: str,
94
+ table_id: str,
95
+ records: List[Dict],
96
+ schema_columns: List[Dict],
97
+ partitioning_column_name: str,
98
+ partition_type=bigquery.TimePartitioningType.DAY,
99
+ ):
100
+ bq_table = self.check_table_exists(dataset_id, table_id)
101
+ if bq_table is None:
102
+ bq_table = self.create_partitioned_table(
103
+ dataset_id,
104
+ table_id,
105
+ schema_columns,
106
+ partitioning_column_name,
107
+ partition_type,
108
+ )
109
+
110
+ self._insert_into_table(bq_table, records)
111
+
91
112
  def delete_table(self, dataset_id: str, table_id: str) -> None:
92
113
  if self.check_table_exists(dataset_id, table_id):
93
114
  sql_format = self._get_table_id_sql_format(dataset_id, table_id)
@@ -99,6 +120,35 @@ class BigQuery:
99
120
  except google.cloud.exceptions.NotFound:
100
121
  return None
101
122
 
123
+ def create_partitioned_table(
124
+ self,
125
+ dataset_id: str,
126
+ table_id: str,
127
+ schema_columns: List[Dict],
128
+ partitioning_column_name: str,
129
+ partition_type=bigquery.TimePartitioningType.DAY,
130
+ ):
131
+ table_schema = [
132
+ bigquery.schema.SchemaField(
133
+ row["name"],
134
+ row["col_type"],
135
+ mode=row["mode"],
136
+ fields=self.parse_fields(row["fields"]) if "fields" in row else [],
137
+ )
138
+ for row in schema_columns
139
+ ]
140
+ try:
141
+ sql_format = self._get_table_id_sql_format(dataset_id, table_id)
142
+ table_object = bigquery.Table(sql_format, schema=table_schema)
143
+ # Set partitioning on the "report_date" column
144
+ table_object.time_partitioning = bigquery.TimePartitioning(
145
+ type_=partition_type,
146
+ field=partitioning_column_name, # The column to use for partitioning
147
+ )
148
+ return self._service.create_table(table_object)
149
+ except google.cloud.exceptions.Conflict:
150
+ return False
151
+
102
152
  def create_table(
103
153
  self, dataset_id: str, table_id: str, schema_columns: List[Dict]
104
154
  ) -> Union[bool, Table]:
@@ -39,6 +39,7 @@ class MicrosoftAdvertising:
39
39
  )
40
40
  self._GET_BUDGET_SUMMARY_REPORT = self._URL + "/budget-summary-report"
41
41
  self._GET_SHARE_OF_VOICE_REPORT = self._URL + "/share-of-voice-report"
42
+ self._GET_SEARCH_CAMPAIGNS_CHANGE_HISTORY_REPORT = self._URL + "/search-campaigns-change-history-report"
42
43
 
43
44
  def get_destination_url_report(
44
45
  self,
@@ -278,6 +279,43 @@ class MicrosoftAdvertising:
278
279
  else:
279
280
  raise MicrosoftAdvertisingException(response.content)
280
281
 
282
+ def get_search_campaigns_change_history_report(
283
+ self,
284
+ account_id: str,
285
+ secret_id: str,
286
+ date_from: str,
287
+ date_to: str,
288
+ report_columns: List[str]
289
+ ):
290
+ """
291
+ Calls endpoint for getting search campaigns change history
292
+ :param account_id: The ID of the account in Microsoft Advertising
293
+ :param secret_id: The ID of the secret in secret manager
294
+ :param date_from: The date we want the report to start from. Must be before date to
295
+ :param date_to: The date we want the report to end at
296
+ :param report_columns: stats we want included in the report
297
+ :return: List of changes
298
+ """
299
+
300
+ body = {
301
+ "account_id": account_id,
302
+ "secret_id": secret_id,
303
+ "date_from": date_from,
304
+ "date_to": date_to,
305
+ "report_columns": report_columns,
306
+ }
307
+
308
+ header = get_headers(self._GET_SEARCH_CAMPAIGNS_CHANGE_HISTORY_REPORT)
309
+ response = self.session.request(
310
+ "post", url=self._GET_SEARCH_CAMPAIGNS_CHANGE_HISTORY_REPORT, json=body, headers=header
311
+ )
312
+
313
+ if response.status_code == HTTPStatus.OK:
314
+ service_response = response.json()
315
+ return service_response["data"]
316
+ else:
317
+ raise MicrosoftAdvertisingException(response.content)
318
+
281
319
  def get_accessible_accounts(self, secret_id: str) -> List[dict]:
282
320
  """
283
321
  Gets
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: logos-sdk
3
- Version: 0.0.25.dev13
3
+ Version: 0.0.25.dev15
4
4
  Summary: SDK for Logos platform
5
5
  Home-page: https://bitbucket.org/databy/logos-sdk-pip/src/master/
6
6
  Author: Databy.io
@@ -25,6 +25,7 @@ Dynamic: classifier
25
25
  Dynamic: description
26
26
  Dynamic: description-content-type
27
27
  Dynamic: home-page
28
+ Dynamic: license-file
28
29
  Dynamic: requires-dist
29
30
  Dynamic: summary
30
31