Fumbling - currently not indexed.

I have a bad memory, so I start blogging.

One-liner for Bulk Deletion of Date-Suffixed Tables in BigQuery

Objective and Background In BigQuery, we often save historical data by appending suffixes like _YYYYMMDD to table names. Over time, this can lead to an accumulation of many versions of data that need to be deleted. However, the GCP console only allows deletion of one table at a time, and the bq command does not support wildcard deletions. To address this, we use the following approach. One-liner Replace <Project_name>, <Dataset_Name>, and <Table_Name_Pattern_To_Delete> in the command below. bq query --project_id=<Project_name> --use_legacy_sql=false --format=csv --max_rows=1000 "SELECT table_id FROM \`<Product_Name>.<Dataset_Name>.__TABLES__\` WHERE table_id LIKE '%<Table_Name_Pattern_To_Delete>%'" | tail -n +2 | xargs -I {} bq rm -f -t <Product_Name>:<Dataset_Name>.{} Additional Notes ‐ It is advisable to verify the target tables before executing the deletion. Use the following command to check: ...

October 24, 2024 · 1 min · 179 words

Use lowercase for all object names - PostgreSQL

In PostgreSQL, always use lowercase for object names (table names, column names) Reason In the database, uppercase and lowercase are distinguished when registering object names. In SQL, when enclosed in double quotes (" “), the exact string is used, but if not enclosed, the name is converted to lowercase (apparently). As a result, mismatches may occur. testdb=> \d iris Table "public.iris" Column | Type | Modifiers ---------------+-----------------------+----------- Id | integer | not null SepalLengthCm | numeric(15,2) | SepalWidthCm | numeric(15,2) | PetalLengthCm | numeric(15,2) | PetalWidthCm | numeric(15,2) | Species | character varying(20) | Indexes: "iris_pkey" PRIMARY KEY, btree ("Id") testdb=> select * from iris where SepalLengthCm > 5.0; --<--- NG ERROR: column "sepallengthcm" does not exist LINE 1: select * from iris where SepalLengthCm > 5.0; ^ HINT: Perhaps you meant to reference the column "iris.SepalLengthCm". testdb=> select * from iris where "iris.SepalLengthCm" > 5.0; --<--- NG ERROR: column "iris.SepalLengthCm" does not exist LINE 1: select * from iris where "iris.SepalLengthCm" > 5.0; ^ testdb=> select * from iris where "SepalLengthCm" > 5.0; --<--- OK testdb=> select * from iris where iris."SepalLengthCm" > 5.0; --<--- OK my previous blog post https://pumpkinpie-tea.blogspot.com/2016/06/postgresql.html ...

October 19, 2024 · 1 min · 192 words

Building up vocabulary of Bahasa Indonesia (verb)

verb - kata kerja - 動詞 # Bahasa Indonesia Contoh kalimat English Japanese 5 percaya Saya percaya begitu. believe 信じる 4 bilang Dia bilang bahwa dia sudah pernah pergi ke Jerman. said 言った 3 berkata Dia berkata bahwa dia sudah pernah pergi ke Jerman. said 言った 2 nikmati (menikmati) Selamat menikmati liburan! enjoy 楽しむ 1 tahu Saya tidak tahu. know 知る

October 19, 2024 · 1 min · 61 words

Start new blog

About This Blog This blog is a migration from my previous site. The previous URL was https://pumpkinpie-tea.blogspot.com/ Purpose of the Migration There were several reasons for migrating this site, primarily to experiment with the following technical aspects: Setting up a website with a custom domain Configuring and optimizing Google Analytics (GA) and SEO Building a website using a static site generator (Hugo) Hosting the site using Firebase Hosting It serves as a personal notepad, where I document my thoughts, experiments, and learning process. It’s a space for me to organize ideas and explore new technologies. ...

October 15, 2024 · 1 min · 95 words