2024-09-01ãã1ã¶æéã®è¨äºä¸è¦§
â ã¯ããã« å°ãã¿ã Snowflake ã® ãã©ã¡ã¼ã¿ãENABLE_UNREDACTED_QUERY_SYNTAX_ERRORãã«ã¤ã㦠ç¥ã£ãã®ã§ãã¡ã¢ã£ã¦ããã ç®æ¬¡ ãï¼ãå°å ¥ï¼Snowflake ã«ãããWebUIã®ã¯ã¨ãªå±¥æ´ ãï¼ãENABLE_UNREDACTED_QUERY_SYNTAX_ERROR ãï¼ãè¨å®æ¹æ³ ãï¼ãå°â¦
â ã¯ããã« dbt ã§ãç´æ¥æå®ãã以å¤ã§ã DB / Schema / Table ãæå®ããæ¹æ³ãåãä¸ããã ç´æ¥æå®ãããããã ãã¼ã«ã«ã»éçºã»æ¬çªç°å¢ãªã©ã§å¤æ´ããå ´åã« å½¹ç«ã¤ãã¨ãããã®ã§ã ç®æ¬¡ ãï¼ãDB / Schema ãæå®ããæ¹æ³ ï¼ï¼profiles.yml ã§æå®â¦
â ã¯ããã« Localéçºç°å¢ã¯PostgreSQL㧠æ¬çªç°å¢ã¯Snowflake㧠DBï¼DWHï¼éã«ã¯ãDBTã§å¸åãã¦ããã æã«ããã§ãéãã§ã¨ã©ã¼ã«ãªãå ´åããã£ãã®ã§ åå ãã¡ã¢ã£ã¦ãã ç®æ¬¡ ãï¼ããã¼ã¿æºå ï¼ï¼PostgreSQLç°å¢ ï¼ï¼ä½¿ç¨ãã¼ã¿ ãï¼ãWHEREå¥ã§ã¨ã¤â¦
â ã¯ããã« SQLFluff ã§ã¨ã©ã¼ããããä»ã®ã¡ã³ãã¼ã解決ãã¦ãããã®ã ã è²ã ã¨åå¼·ã«ãªã£ãã®ã§ããã©ãã«ãã¡ã¢ã£ã¦ãã ãï¼ããã©ãã«æ¦è¦ SQLFluffã§Linterå®è¡å¾ã«ãã¨ã©ã¼å 容ãã表示 ãï¼ãã¨ã©ã¼å 容 ConfigLoader.get_global() is deprecated,â¦
â ã¯ããã« https://dk521123.hatenablog.com/entry/2024/08/11/123351 ã§ã以åãgit diffã³ãã³ããå©ç¨ãã¦ã å¤æ´ããããã¡ã¤ã«ã ãLinterã«æ¸ããã¨ãã£ã Github Actionsãæ¸ãã¦ã¿ãã ã§ãä»æ¥ãåé¤ãããã¡ã¤ã«ããã®ã¾ã¾Linterã«æ¸ãã¦ãã¾ã£ã¦â¦
â ã¯ããã« ã·ã¹ãã ã®ãã¤ã°ã¬ã¼ã·ã§ã³ã§ ãã¼ãã«å·®åã調æ»ããå¿ è¦ãã§ããã®ã§ ãã®ããæ¹ã調ã¹ã¦ã¿ã ç®æ¬¡ ãï¼ããã¼ã¿æºå ï¼ï¼ä½¿ç¨ãã¼ã¿ ãï¼ãæ¹æ³ï¼ï¼å·®éå EXCEPT / MINUS ï¼ï¼ãµã³ãã« ï¼ï¼ä½¿ç¨ä¸ã®æ³¨æ ãï¼ãæ¹æ³ï¼ï¼LEFT OUTER JOIN ï¼ï¼â¦
â ã¯ããã« ä»ã¡ã³ãã¼ã®Pythonã³ã¼ããè¦ã¦ãã¦ã ~~~ paginator = client.get_paginator('list_objects_v2') ~~~ ã£ã¦ã§ã¦ãã¦ããªãã ããï¼ã£ã¦ãªã£ãã®ã§ 調ã¹ã¦ã¿ãã ç®æ¬¡ ãï¼ãPaginators ãç¥ãåã« ãï¼ãPaginators ãï¼ããµã³ãã« ä¾ï¼ï¼Hello â¦
â ã¯ããã« Snowflakeã§ç®¡çãã¦ãããã¼ãã«ã®IDã«ã"123401"ãã®ããã« ããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã®å²ã¿æåãæ··ãã£ã¦ããã é¤å»ããããããããããä»æ´ãªããã ã·ã³ã°ã«ã»ããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã®éãã¨ã ããã¾ãã ã£ãã®ã§ããã®å¨è¾ºã®ç¥èã調ã¹â¦
â ã¯ããã« https://dk521123.hatenablog.com/entry/2023/01/16/000000 https://dk521123.hatenablog.com/entry/2024/09/12/003814 ã§ãSQLã®éåæ¼ç®ã«ã¤ãã¦ãæ±ã£ãã ä»åã¯ãSQLã®éåæ¼ç®ãå©ç¨ãã¦ã delete + insert å¾ã®ãã¼ã¿ç¢ºèªãã¦ã¿ãã ã©ã³â¦
â ã¯ããã« å°ãã¿ã Snowflake ã® NULL ã®æ±ãã«ã¤ãã¦ãã¡ã¢ã£ã¦ãã ç®æ¬¡ ãï¼ãIFNULL ãï¼ãNULLIF ãï¼ãNULLIFZERO ãï¼ãEQUAL_NULL ãï¼ãIS_NULL_VALUE ãï¼ãCOALESCE ãï¼ãIFNULL -- expr1 ã NULL ã®å ´åã¯ã expr2 ãè¿ã -- ãã以å¤ã®å ´åâ¦
â ã¯ããã« https://dk521123.hatenablog.com/entry/2023/01/16/000000 https://dk521123.hatenablog.com/entry/2024/09/12/003814 ã§ãSQLã®éåæ¼ç®ã®ä¸ã§ ç©éåï¼å ±éé¨åã®ç®åºï¼ããéã® INTERSECT ãè¡ãã®ã ã ä¸åº¦ãã¡ããã¨åãä¸ãã¦ããªãã£ãã®â¦
â ã¯ããã« Snowflakeã§ãã©ãã«ã·ã¥ã¼ãã£ã³ã°ããã®ã§ãã¡ã¢ã ãï¼ããã©ãã«æ¦è¦ 以ä¸ãå®è¡ããSQLãã®ããã« CREATE TABLE ... CLONE ã§ãã¼ãã«ã®ããã¯ã¢ããã試ã¿ãã¨ããã 以ä¸ããï¼ãã¨ã©ã¼å 容ããçºçããã å®è¡ããSQL CREATE TABLE demo_â¦
â ã¯ããã« https://dk521123.hatenablog.com/entry/2023/01/16/000000 ã§ãSQLã®ä¸è¬ã®éåæ¼ç®ã«ã¤ãã¦è§¦ããã ä»æ¥ãSnowflake å ã«æ ¼ç´ããã¦ãããã¼ã¿ãæ¤è¨¼ããããã« å·®éåã使ã£ãã®ã§ããã®éã®ãã¨ãªã©ãçºãã¦ãã ç®æ¬¡ ãï¼ãSnowflake ã® éâ¦
â ã¯ããã« dbt ã解æããªãã¦ã¯ãªããããã®ä¸ã§ ifæã§åå²ãã¦ããç®æããã£ãã®ã§ ããã«ä»éããTipsãªã©ãã¾ã¨ãã¦ãã ç®æ¬¡ ãï¼ãifæ ï¼ï¼æ§æ ï¼ï¼æ¼ç®å ãï¼ãé¢é£ããDBTãã¯ã ï¼ï¼is_incremental() ï¼ï¼load_relation ï¼ï¼run_query() ãï¼â¦
â ã¯ããã« åçãªdbt å®è¡æã§ã®ãã©ãã«ã·ã¥ã¼ããå¾ã ã«è¨é²ãã¦ãã ç®æ¬¡ ãï¼ãAirflow + dbt ã§ã¨ã©ã¼ãTask exited with return code -9ã ãï¼ãã¨ã©ã¼ã'>' not supported between instances of 'Table' and 'int'ã ãï¼ãAirflow + dbt ã§ã¨ã©ã¼â¦
â ã¯ããã« Parquet ãã¡ã¤ã«ãæ±ããã¨ã«ãªãããã¹ããã¼ã¿ãä½ãããã®ã§ Pythonã§ããã°ãPandas ã§Parquet ãæ±ãã®ãä¸çªæ¥½ãããªã®ã§ åå¥ã«ã¾ã¨ãã¦ãã ç®æ¬¡ ãï¼ãã¤ã³ã¹ãã¼ã« ãï¼ãParquet ã®æ¸ãåºãã»èªã¿åºã ï¼ï¼åºåã»æ¸ãåºã ï¼ï¼å ¥åã»â¦
â ã¯ããã« https://dk521123.hatenablog.com/entry/2023/03/18/034704 ã®ç¶ãã æ£è¦è¡¨ç¾ã«é¢ãã¦ãScalaã®ã©ã¤ãã©ãªã¯ä½¿ããªããããªã®ã§ Javaã®ã©ã¤ãã©ãªã§å®è£ ãã¦ã¿ã ãï¼ããµã³ãã« ä¾ï¼ï¼ãã¡ã¤ã«åã«ä»å ããã¦ããæ¥ä»ãåå¾ãã import java.utâ¦
â ã¯ããã« dbt ã® rows_affected ã1æ¥ä¸èª¿æ»ãã¦ãã®ã§ å¾ã ã«çºãã¦ããã ç®æ¬¡ ãï¼ãrows_affected ãï¼ãSnowflake ã«ãããrows_affected ï¼ï¼ãã©ãã«ï¼CREATE TABLE ... AS SELECT ã®å ´åãrows_affected=1ãè¿ã ãï¼ãrows_affected * å®è¡ãããâ¦