Do you want to stream your data to Google BigQuery? Are you finding it challenging to load your data into your Google BigQuery tables? If yes, then you’ve landed at the right place! This article will answer all your queries & relieve you of the stress of finding a truly efficient solution. Follow our easy step-by-step guide to help you master the skill of seamlessly Streaming Data to BigQuery from a source of your choice in real-time!

It will help you take charge in a hassle-free way without compromising efficiency. This article aims at making the data streaming process as smooth as possible.

Upon a complete walkthrough of the content, you will be able to seamlessly transfer your data to Google BigQuery for a fruitful analysis in real-time. It will further help you build a customized ETL pipeline for your organization. Through this article, you will get a deep understanding of the tools & techniques, and thus, it will help you hone your skills further.

Understanding the Need for Streaming Data to BigQuery

The main requirement for streaming data originates from the need for carrying out real-time data analysis. With streaming data in place, organisations can perform a lightning-quick analysis and make data-driven decisions for numerous business processes. In the case of real-time analysis, organisations prefer to analyse data as and when it comes in without having to wait for the batch load operations to complete. Loading data to Google BigQuery can be a time-consuming task, especially when you’re working with the in-built copy operation. Streaming helps to insert records to Google BigQuery one by one and makes them available for analysis quickly.

The following are some of the typical use-cases that require streaming data-based inserts:

  • In case you’re working with applications that push large volumes of data to the backend, leveraging which you need to generate real-time alerts and alarms. 
  • In case you’ve to prepare and present comprehensive reports and dashboards that update in real-time using the transactional data.

Methods to Stream Data to Google BigQuery

There are multiple ways in which you can stream data to Google BigQuery. Here, you will look into 2 popular methods that you can utilize for streaming data to BigQuery:

Method 1: Streaming Data to BigQuery using Hevo’s No-code Data Pipelines

Hevo Data, a No-code Data Pipeline, helps you stream data from 150+ sources to Google BigQuery & lets you visualize it in a BI tool. Hevo is fully-managed and completely automates the process of not only loading data from your desired source but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Its fault-tolerant architecture ensures that the data is handled in a secure, consistent manner with zero data loss.

It provides a consistent & reliable solution to manage data in real-time and always have analysis-ready data in your desired destination. It allows you to focus on key business needs and perform insightful analysis using various BI tools such as Power BI, Tableau, etc. 

Check out what makes Hevo amazing:

  • Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
  • Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  • Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  • Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
  • Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Method 2: Streaming Data to BigQuery using Python

Google BigQuery houses support for numerous modern programming languages such as Java, Python, Go, etc., allowing users to access & modify their Google BigQuery data by writing custom code snippets. In the case of Python, it requires users to use the Google BigQuery dependency to perform the same.

Download the Cheatsheet on How to Set Up High-performance ETL to BigQuery
Download the Cheatsheet on How to Set Up High-performance ETL to BigQuery
Download the Cheatsheet on How to Set Up High-performance ETL to BigQuery
Learn the best practices and considerations for setting up high-performance ETL to BigQuery

You can implement this using the following steps:

Step 1: Installing the Python Dependency for Google BigQuery

To start Streaming Data to BigQuery using Python, you first need to install the Python dependency for Google BigQuery on your system. To do this, you can make use of the pip install command as follows:

pip install --upgrade google-cloud-BigQuery

This is how you can install the Google BigQuery dependency for Python on your system.

Step 2: Creating the Service Account Key

Once you’ve installed the Python dependency, you now need to create service key for your Google BigQuery instance, that will help provide access to your Google BigQuery data. To do this, go to the official website of Google Search Console and log in with your credentials such as username and password. You can also directly login with your Google account, associated with Google BigQuery database.

Google Cloud Platform Login.
Image Source: Self

Once you’ve logged in, click on the create button to start configuring your service key. Here, you will need to download the key in JSON format and save it on your system. To do this, select the JSON option found in the key-type section and then click on create.

Downloading the Service Key in BigQuery to Start Streaming Data to BigQuery.
Image Source: self

The service key file will now start downloading on your system. Save the file and safely copy the path of this location.

Once you’ve successfully downloaded the file, you need to configure the environment variable, thereby allowing Python’s BigQuery client to access your data. To do this, add the path of your JSON file to the environment variable as follows:

export GOOGLE_APPLICATION_CREDENTIALS="/home/user/keys/google-service-key

This is how you can create and configure the account service key for your Google BigQuery instance.

Step 3: Coding the Python Script to Stream Data to Google BigQuery

With your service key now available, you can start building the Python script for streaming data to BigQuery tables. To do this, import the necessary libraries as follows:

from import BigQuery

Once you’ve imported the libraries, you need to initialise the client for your Google BigQuery instance to set up the connection. You can use the following line of code to do this:

client = bigquery.Client()

With your connection now up and running, you now need to configure the Google BigQuery table in which you want to insert the data. To do this, you can use the following lines of code:

table_name = "<your fully qualified table name >"
insert_rows = [
    {u"firstname": u"Arsha",u”lastname”:u”richard”,u"age": 32},
    {u"firstname": u"Shneller",u”lastname”:u”james”,u"age": 39},

You can now start loading your data into your Google BigQuery table using the Python script as follows:

errors = client.insert_rows_json(table_name, insert_rows)  
if result == []:
    print("Added data")
    print("Something went wrong: {}".format(result))

This is how you can use Python’s Google BigQuery dependency to start Streaming Data to BigQuery.

Seamlessly Integrate Your Data with Hevo’s Automated Data Pipelines

Hevo is the only real-time ELT No-code Data Pipeline platform that cost-effectively automates data pipelines that are flexible to your needs. With integration with 150+ Data Sources (40+ free sources), we help you not only export data from sources & load data to the destinations but also transform & enrich your data, & make it analysis-ready.

Start for free now!

Get Started with Hevo for Free

Limitations of Streaming Data to Google BigQuery Manually

  • Streaming data to BigQuery requires you to write multiple custom integration-based code snippets to establish a connection, thereby making it challenging, especially when the data source is not a Google service.
  • This method of streaming data to BigQuery fails to handle the issue of duplicate records. It requires you to write custom code that will help identify the “duplicate” rows and, help remove them from the database after the insertion process.
  • Google BigQuery follows a complex quota-based policy that considers numerous factors such as, whether you’re using the de-duplication feature, etc. It thus requires you to prepare your code carefully with the quota policy in mind.


This article teaches you how to start Streaming Data to BigQuery with ease. It provides in-depth knowledge about the concepts behind every step to help you understand and implement them efficiently. These methods, however, can be challenging especially for a beginner & this is where Hevo saves the day. You can use Hevo for streaming Data to BigQuery in an easy and hassle-free manner.

Hevo Data, a No-code Data Pipeline, helps you transfer data from a source of your choice in a fully-automated and secure manner without having to write the code repeatedly. Hevo, with its strong integration with 150+ sources & BI tools, allows you to not only export & load data but also transform & enrich your data & make it analysis-ready in a jiff.

Visit our Website to Explore Hevo

Want to take Hevo for a spin? Sign Up for the 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at our unbeatable pricing that will help you choose the right plan for your business needs!

Tell us about your experience of Streaming Data to BigQuery! Share your thoughts in the comments section below!

Software Developer, Hevo Data

Talha is a seasoned Software Developer, currently driving advancements in data integration at Hevo Data, where he have been instrumental in shaping a cutting-edge data integration platform for the past four years. With a significant tenure at Flipkart prior to their current role, he brought innovative solutions to the space of data connectivity and software development.

No-code Data Pipeline For Google BigQuery