How to load data from SpaceX API to BigQuery
Learn how to use Airbyte to synchronize your SpaceX API data into BigQuery within minutes.


Building your pipeline or Using Airbyte
Airbyte is the only open source solution empowering data teams to meet all their growing custom business demands in the new AI era.
- Inconsistent and inaccurate data
- Laborious and expensive
- Brittle and inflexible
- Reliable and accurate
- Extensible and scalable for all your needs
- Deployed and governed your way
Start syncing with Airbyte in 3 easy steps within 10 minutes



Take a virtual tour
Demo video of Airbyte Cloud
Demo video of AI Connector Builder
Setup Complexities simplified!
Simple & Easy to use Interface
Airbyte is built to get out of your way. Our clean, modern interface walks you through setup, so you can go from zero to sync in minutes—without deep technical expertise.
Guided Tour: Assisting you in building connections
Whether you’re setting up your first connection or managing complex syncs, Airbyte’s UI and documentation help you move with confidence. No guesswork. Just clarity.
Airbyte AI Assistant that will act as your sidekick in building your data pipelines in Minutes
Airbyte’s built-in assistant helps you choose sources, set destinations, and configure syncs quickly. It’s like having a data engineer on call—without the overhead.
What sets Airbyte Apart
Modern GenAI Workflows
Move Large Volumes, Fast
An Extensible Open-Source Standard
Full Control & Security
Fully Featured & Integrated
Enterprise Support with SLAs
What our users say

Raman Singh
Predictable, straightforward pricing model that simplified budgeting and significantly reduced overall spend

Chase Zieman

“Airbyte helped us accelerate our progress by years, compared to our competitors. We don’t need to worry about connectors and focus on creating value for our users instead of building infrastructure. That’s priceless. The time and energy saved allows us to disrupt and grow faster.”

Rupak Patel
"With Airbyte, we could just push a few buttons, allow API access, and bring all the data into Google BigQuery. By blending all the different marketing data sources, we can gain valuable insights."
How to Sync to Manually
Start by creating a new Google Cloud Project if you haven't already. Go to the Google Cloud Console, click on the project dropdown at the top, and select "New Project." Provide a name and billing account for the project to enable necessary services.
Within your Google Cloud Project, navigate to the "APIs & Services" section and enable the BigQuery API. This is essential for interacting with BigQuery programmatically.
Go to the BigQuery Console in your Google Cloud Project. Click on "Create Dataset," specify a name and data location, and configure any relevant access controls. This dataset will hold the tables where SpaceX data will be stored.
Use Python to fetch data from the SpaceX API. You can use the `requests` library to make HTTP GET requests. For example, to fetch launch data, use:
```python
import requests
response = requests.get('https://api.spacexdata.com/v4/launches')
spacex_data = response.json()
```
Analyze the JSON structure of the SpaceX API response and design a BigQuery table schema that matches it. Ensure all fields in the JSON response are accounted for. You may need to flatten nested JSON objects into a relational table format.
Use the Python `google-cloud-bigquery` library to load data into BigQuery. First, install the library using pip:
```bash
pip install google-cloud-bigquery
```
Then, use the following script to load data:
```python
from google.cloud import bigquery
import json
client = bigquery.Client()
dataset_id = 'your_dataset_id'
table_id = 'your_table_id'
table_ref = client.dataset(dataset_id).table(table_id)
job_config = bigquery.LoadJobConfig(
source_format=bigquery.SourceFormat.NEWLINE_DELIMITED_JSON,
autodetect=True,
)
# Convert the list of JSON objects to newline-delimited JSON
json_data = '\n'.join([json.dumps(record) for record in spacex_data])
load_job = client.load_table_from_json(
json_data,
table_ref,
job_config=job_config
)
load_job.result() # Wait for the load job to complete
```
Once the data is loaded, verify the integrity by running SQL queries in the BigQuery Console. Check the number of records and compare them with the API to ensure all expected data is present and correctly formatted.
By following these steps, you can efficiently transfer data from the SpaceX API to BigQuery without the need for third-party connectors or integrations.