From c059890ba7f4d5eb56e2ed931dc1404d9d570f6b Mon Sep 17 00:00:00 2001 From: mmaurostoffel <166130318+mmaurostoffel@users.noreply.github.com> Date: Sun, 12 Jan 2025 16:53:31 +0100 Subject: [PATCH] =?UTF-8?q?singleScrape=5Fof=5Fregion=20eingef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etl/src/data/database.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/etl/src/data/database.py b/etl/src/data/database.py index b5f2f1b..28cd988 100644 --- a/etl/src/data/database.py +++ b/etl/src/data/database.py @@ -443,6 +443,21 @@ class Database: properties.seed_id = {region_id} """) + def singleScrape_of_region(self, region_id: int, scrape_date_min: str, scrape_date_max: str): + return self.connection.sql(f""" + SELECT + JSON_EXTRACT(body, '$.content.days') as calendarBody, + FROM + consultancy_d.extractions + LEFT JOIN + consultancy_d.properties ON properties.id = extractions.property_id + WHERE + type == 'calendar' AND + properties.seed_id = {region_id} AND + extractions.created_at >= '{scrape_date_min}' AND + extractions.created_at < '{scrape_date_max}' + """) + def capacity_global(self): return self.connection.sql(f""" SELECT