Announcing PhotonIQ: The New AI CDN For Accelerating Apps, APIs, Websites and Services
Edge

The Macrometa Platform Now Supports The SQL Language

Post Image

We are pleased to announce that the Macrometa Global Data Mesh now includes native support for SQL. This blog post discusses how we did it (and why it is important) and then digs deeper into how to write queries.

What is Macrometa?

Macrometa’s Global Data Network (GDN) is a Platform as a Service for building and running applications at the edge. Run regionally, globally, or both - the GDN automatically synchronizes data between locations in milliseconds. Build new applications or extend existing applications to improve performance and comply with data locality requirements. We provide data and compute infrastructure from more than 175 locations globally, reaching two billion users and ten billion devices in 50ms.

Macrometa SQL Support

With the launch of Postgres SQL support in our latest release, developers don’t need to learn a new query language to harness the power of the platform.

Historically, SQL has been used to manage relational databases on-premises, and more recently it powers many major legacy cloud databases, such as Snowflake and Amazon RDS. SQL has been with us since the 1970s and is the database query language powering most websites, most business logic, and business intelligence applications in businesses both large and small across the globe. SQL is by far the most popular language in the world for querying databases. When we compare SQL with any general-purpose language by usage, it sits around tenth place. (https://www.tiobe.com/tiobe-index/)

If we take a look at the yearly Stack Overflow survey, SQL sits in fourth place and is ranked above general-purpose language giants such as C# and Java.

Image

Stackoverflow survey from 2021

The Macrometa platform is a distributed edge-native platform that runs across multiple data centers. Most real-life applications are stateful and our platform maintains state across up to 175 locations globally, allowing you to automatically synchronize session state and any other data you store in the Global Data Mesh, all at the speed of light.

In the latest release, we have added support for the Postgres SQL query language in the Macrometa Global Data Network. With this addition, SQL - which has been traditionally used with monolithic platforms - can be used with the distributed Global Data Network. There’s no learning curve because developers can continue using the tools and language they are comfortable working with.

Example of SQL query:

SQL Query: 
UPDATE Animals 
SET AnimalName = 'Octopus', 
Habitat= 'Sea' 
WHERE AnimalID = 1;

How to write SQL queries with Macrometa

Although SQL is an ANSI/ISO standard, there are different vendor-specific versions of the language with database-specific extensions to the standard. The Macrometa SQL dialect supports PostgreSQL DQL (SELECT statement), DML statements (UPDATE, INSERT and DELETE), and a subset of Postgres DDL statements.

The general workflow when executing a query is as follows:

  • A client application sends a SQL query to the Macrometa platform. The query text contains everything Macrometa needs to compile the result set.
  • Macrometa’s Global Data Mesh parses the query, creates a query plan, executes it, and compiles the results to return to your application. If the query is invalid or cannot be executed, Macrometa returns an error that the client can process and respond to. If the query can be executed successfully, the server will return the query results to the client.

For example, we can write classical SQL syntax to insert values into the database:

INSERT INTO categories (_key,AnimalName,Habitat) VALUES('0', 'Octopus','Sea')

Macrometa includes some “quality of life” extensions to SQL, for example we can insert multiple values in the table using a JSON string:

INSERT INTO categories VALUES 
('{\"_key\":\"1\",\"AnimalName\":\"Octopus\",\"Habitat\":\"Sea\"}'),
('{\"_key\":\"2\",\"AnimalName\":\"Dog\",\"Habitat\":\"Land\"}')

SQL queries can be sent to Macrometa through the Web Console, REST APIs, SDKs, and the Macrometa CLI.

Wrapping up

The Macrometa Global Data Network provides very low latency and very high performance for your applications. You can get productive on Macrometa’s platform right away by using standard SQL. We also support the Macrometa native query language, DynamoDB APIs, and Redis APIs.

Get started today by requesting a 30 day trial and be sure to check out the rest of our Developer Week content.

Join our newsletter and get the latest posts to your inbox
Form loading...





Featured Posts

Related Posts

Recent Posts

Platform

PhotonIQ
Join the Newsletter