Skip to content

Instantly share code, notes, and snippets.

@1ambda
Created December 26, 2021 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1ambda/ab68edce96c4c1f9f0f66c36b14783fa to your computer and use it in GitHub Desktop.
Save 1ambda/ab68edce96c4c1f9f0f66c36b14783fa to your computer and use it in GitHub Desktop.
propertyTypeHouse = 'House'
dfListingHouseAvailable = spark.sql(f"""
WITH
LISTING_HOUSE AS (
SELECT id as listing_id, listing_url, name
FROM LISTING_META
WHERE property_type = '{propertyTypeHouse}'
)
SELECT
LISTING_CALENDAR.listing_id,
listing_url,
name as listing_name,
date,
available,
price
FROM LISTING_CALENDAR
INNER JOIN LISTING_HOUSE
ON LISTING_CALENDAR.listing_id = LISTING_HOUSE.listing_id
WHERE LISTING_CALENDAR.available = 't'
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment