Skip to content

Instantly share code, notes, and snippets.

View boonhapus's full-sized avatar

SN boonhapus

View GitHub Profile
@boonhapus
boonhapus / 1_README.md
Last active November 26, 2024 18:17
TS_CUSTOM_CALENDAR_EXPLAINED

ThoughtSpot Custom Calendar

The [Custom Calendar][ccal-docs] feature in ThoughtSpot powers the date keywords. The concepts "yearly", "quarterly", or "weekly" may be skewed (or offset) based on what day determines the start and end boundaries for each of those periods.

This is the ONLY purpose the Custom Calendar feature serves - to provide semantic meaning to DATE and DATE_TIME columns. You cannot use Custom Calendars to encode custom date keywords (eg. Is Holiday = TRUE|FALSE).

When creating a Custom Calendar from a SQL query, the [table DDL must exactly match the names][ccal-schema] and types that ThoughtSpot expects. For this reason, it is advised to create a separate database Table or View in order to isolate these columns.


@boonhapus
boonhapus / security_logs.py
Created December 1, 2023 19:06
Connection Event Logs
from __future__ import annotations
import datetime as dt
import json
import httpx # pip install httpx
class RESTAPIV1(httpx.Client):
"""It's just an HTTP client."""
@boonhapus
boonhapus / PY_UDF_SNOWFLAKE_PARSE_TS_COMMENT_TAG.sql
Last active October 30, 2024 17:58
Parse ThoughtSpot Query comment tag
CREATE OR REPLACE FUNCTION ts_query_tag_comment_json(query STRING)
returns variant not null
language python
runtime_version = '3.8'
handler = 'extract_query_tag_as_json'
AS
$$
from __future__ import annotations
import re