PHP

Google BigQuery Example to converted Nested FIelds in JSON

CK CK 3788 
Created at
Updated at  
462 0 0

When Kafka is integrated into a system, nested fields are often created to represent complex data structures more effectively, but this is something hard to use when we integrate with Google BigQuery.

Below is a basic query example to have some data sets from Google BigQuery

SELECT *
FROM
    `lucid-bebop-474.player_event.kafka_raw`
WHERE DATE(dt) = '2024-07-01'
ORDER BY dt DESC
LIMIT 100;

The result is displayed in the Google BigQuery Console like below:

Google BigQuery Example to converted Nested FIelds in JSON

 

In case that you want to convert nested_fields in Json, below example will be helpful to understand:

SELECT
	dt,
	TO_JSON_STRING(nested_fields) as json
FROM
	`lucid-bebop-474.player_event.kafka_raw`
WHERE DATE(dt) = '2024-07-02'
ORDER BY dt DESC
LIMIT 100;

Google BigQuery Example to converted Nested FIelds in JSON

The bad point for above case is that we can't make query easily, because the keyvalue is stored in the field which is named as “json” for above case.

 

Tags BigQuery Google BigQuery Nested Fields Facebook X
Comments 0
Similar posts
  1. Using BigQuery in Python
    414
  2. Simple Example to get the total number of records in BigQuery with Python
    668
  3. Node.js code example to access Google BigQuery
    1,184
  1. When you Postgresql Module is not able to open connection : Doubt your libpq version
    480
  2. How to Get a YouTube Channel ID from a URL in PHP
    1,030
  3. Building a MCP server in PHP
    639
  4. PHP 7 vs PHP 8
    1,255
  5. Upgrading PHP 7.4 to PHP 8.1 in CentOS 7
    653
  6. gRPC Server with PHP
    510
  7. PHP Code to Fetch current Coinbase Assets (Balances)
    444
  8. PHP Code to Fetch PEPE coin pricing based in USD from Coinbase
    367
  9. Google Single Sign-On implementation with PHP
    1,382
  10. PHP Superglobal Variables do not require additional syntax to access it
    2,659
  11. Run Python Code with Virtual Environment in PHP
    676
  12. PHP Simplified Operators
    318
  13. PHP Heredoc (aka Nowdoc)
    450
  14. PHP Post Processing by disconnecting HTTP connection and continuing the remaining logics
    1,825
  15. WordPress Remote Posting with PHP
    1,704
  16. Verifying Apple In-App Purchase validation receipt with PHP
    1,807
  17. Useful code for file-based Unit Test in PHP
    508
  18. Function Overloading Implementation in PHP with Magic Mathods
    1,766
  19. PHP Magic - the Null Coalescing Operator (??) - return the value if the give variable is NULL
    1,683
  20. How do I find php.ini on Mac?
    496
  21. Mastering Excel Data Importation in PHP
    558
  22. Create Blob Image in HTML based on the given Text, Width and Height in the Center of the Image without saving file
    986
  23. How do I determine the client IP type (IPv4/IPv6) in PHP
    840
  24. What is 302 Found Redirection in HTTP 1.1?
    497
  25. Implementing a Versatile DNS Server in PHP: Handling A, AAAA, CNAME, and TXT Records
    624
  26. Building a Basic DNS Server in PHP/Python: A Beginner's Guide
    747
  27. CentOS 7 PHP Apache Kafka: Installation, Examples, and System Diagram
    311
  28. Apache Kafka Explained: Powering Netflix, Building with PHP
    495
  29. Array of arguments passed to script in PHP
    99
  30. Bob Jenkins' One-At-A-Time hashing algorithm in PHP
    57
Recently updated
  1. Google OAuth Token Expiration: Causes and Solutions
    31
  2. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    57
  3. Why SPF and DKIM Are Essential for Linux Email Servers?
    51
  4. How do I create animated background for Google Meet?
    23,256
  5. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    273
  6. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    105
  7. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    170
  8. Invalid Auction Storms in Ad Tech
    108
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    209
  10. The Two Clocks of Ad Server Architecture
    78
  11. Frequency Cap Architecture Overview
    527
  12. Collecting Proof-of-Play from 100,000 Screens
    154
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    303
  14. What is RedisVL?
    117
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    247
  16. TPU & GPU Cluster Management Tools
    258
  17. The Concept of Scaffolding in AI Agents
    245
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    599
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    269
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    355
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    207
  22. Machine Learning: Training vs. Ranking
    231
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    229
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    204
  25. Designing a Data Curation System Around a Vector Database
    230
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    264
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    674
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    201
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    233
  30. Understanding Data Lineage
    272