Skip to content

Commit 1bc13f3

Browse files
committed
add blog post
1 parent c6ba0de commit 1bc13f3

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
date: 2023-08-30
3+
authors:
4+
name: Jimmy Yeh
5+
title: core member of VulcanSQL
6+
url: https://github.com/cyyeh
7+
image_url: https://avatars.githubusercontent.com/u/11023068?v=4
8+
email: jimmy.yeh@cannerdata.com
9+
---
10+
11+
# Query Data from the Internet and Deliver APIs in no time
12+
13+
*TLDR: VulcanSQL, a free and open-source data API framework built specifically for data applications,
14+
empowers data professionals to generate and distribute data APIs quickly and effortlessly.
15+
It takes your SQL templates and transforms them into data APIs, with no backend expertise necessary.*
16+
17+
## One Way to Understand APIs
18+
19+
As an API designer, we can think of APIs composed of three components, namely **input**, **transformation** and **output**.
20+
21+
Let's start with the input component, we need to consider what are data sources of APIs. Generally, data sources
22+
can be databases, files on the FTP server, etc. After we decide what data sources our APIs support, we need to
23+
also support different mechanisms in order to get data from data sources.
24+
25+
Then, with the transformation part, it generally is where we handle business logic. Finally, the output part means the destination
26+
of the APIs and also the mechanisms we deliver the APIs, such as RESTful APIs, GraphQL, etc.
27+
28+
Now, let me take VulcanSQL as a quick example, it emphasizes you can write SQL templates in the transformation part,
29+
and it currently supports RESTful APIs for the output part. As of the input, please read the following content to grasp the full story!
30+
31+
![vulcansql](./static/query-data-from-the-internet-and-deliver-apis-in-no-time/vulcansql.png)
32+
33+
<!--truncate-->
34+
35+
## The Input Part: Data Sources
36+
37+
VulcanSQL aims to help data professionals create and deliver data APIs in an easy way!
38+
Originally, VulcanSQL supports data warehouses and some databases such as BigQuery,
39+
Snowflake, ClickHouse and PostgreSQL, etc. However, as we share VulcanSQL to the world
40+
along the way, we figured out that there are also lots of data on the Internet that is not in databases
41+
such as CSV files or data that lives in other people's databases!
42+
43+
That's what we're going to share with you next: how VulcanSQL can help you get data from the Internet!
44+
45+
## How VulcanSQL can help?
46+
47+
As of now, VulcanSQL provides two mechanisms to help you get data from the Internet.
48+
49+
### DuckDB and its httpfs extension
50+
51+
In VulcanSQL, we can use [DuckDB](../docs/connectors/duckdb) as a caching layer to enhance query performance, or as a data connector.
52+
For those of you who may not familiar with DuckDB, it is a high performance in-process OLAP database,
53+
and has lots of extensions available! In order to get data from the Internet, VulcanSQL supports the httpfs extension!
54+
55+
With the [httpfs extension](https://duckdb.org/docs/extensions/httpfs.html), now VulcanSQL can query CSV, JSON and Parquet files from the Internet!
56+
57+
Imagine now you find some interesting dataset on the Internet, and it's a CSV file! Now you can directly query them
58+
like the following SQL statement, then you can do some data transformation using SQL, and deliver APIs right away to share with others!
59+
60+
```sql
61+
SELECT
62+
*
63+
FROM 'https://www.stats.govt.nz/assets/Uploads/Annual-enterprise-survey/Annual-enterprise-survey-2021-financial-year-provisional/Download-data/annual-enterprise-survey-2021-financial-year-provisional-csv.csv'
64+
```
65+
66+
If you would like to read the source code of the full example, please [check out here](https://github.com/Canner/vulcan-sql-examples/tree/main/read-data-from-internet)!
67+
68+
### The API Extension
69+
70+
Sometimes, you may find some interesting data behind RESTful APIs created by others. VulcanSQL now has [the API extension](../docs/extensions/api) that
71+
allows you to query data from 3rd parties using RESTful APIs!
72+
73+
In the following example, we call the RESTful API to `https://dummyjson.com` and search their products with a query string!
74+
75+
```sql
76+
{% set a_variable_you_can_define = { "query": { "q": "phone" } } %}
77+
SELECT {{ a_variable_you_can_define | rest_api(url='https://dummyjson.com/products/search') }}
78+
```
79+
80+
Besides, the API Extension not only supports the GET method, but also other HTTP methods as well!
81+
82+
If you would like to read the source code of the full example, please [check out here](https://github.com/Canner/vulcan-sql-examples/tree/main/restapi-caller).
83+
84+
## Conclusion
85+
86+
We hope this blog post demonstrates how VulcanSQL can help you query data from the Internet, thus you can create and deliver APIs in no time!
368 KB
Loading

0 commit comments

Comments
 (0)