Skip to content

Instantly share code, notes, and snippets.

@YiLi225
Last active March 9, 2022 01:51
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 YiLi225/2370e1e2b5eaa146f9c25934ec58d290 to your computer and use it in GitHub Desktop.
Save YiLi225/2370e1e2b5eaa146f9c25934ec58d290 to your computer and use it in GitHub Desktop.
## Query with placeholders
timeSeries_query = f"""
SELECT
InvoiceDate,
Description,
ROUND(SUM(Quantity * UnitPrice), 2) AS Total_Sale_Amt
FROM
OnlineRetail
WHERE InvoiceDate BETWEEN {date} ## !!! Placeholder for date
AND Description IN ('{product}') ## !!! Placeholder for product
GROUP BY InvoiceDate, Description
ORDER BY InvoiceDate
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment