DEV Community

Pawan Kukreja
Pawan Kukreja

Posted on

2

Introduction of Apache AGE.

Overview

Apache AGE, a PostgreSQL extension, delivers robust graph database capabilities. Representing "A Graph Extension" (AGE), it draws inspiration from Bitnine's variant of PostgreSQL 10, AgensGraph—a versatile multi-model database. The project aims to establish a unified storage solution capable of managing both relational and graph model data. This empowers users to seamlessly leverage standard ANSI SQL alongside openCypher, the designated Graph query language.

Graphs

A graph is made up of vertices and edges, and every node and edge has a unique set of attributes associated with it. The fundamental unit of a graph is a vertex, which is independent of all other nodes in the graph. A directed link between two vertices is formed by an edge.

To create a graph, use the create_graph function, located in the ag_catalog namespace.

Syntax: create_graph(graph_name);

Returns:

void

To delete a graph, use the drop_graph function, located in the ag_catalog namespace.

Syntax: drop_graph(graph_name, cascade);

Returns:

void

Simple Datatype

Null
SELECT *
FROM cypher('graph_name', $$
RETURN NULL
$$) AS (null_result agtype);

Integer
SELECT *
FROM cypher('graph_name', $$
RETURN 1
$$) AS (int_result agtype);

Float
SELECT *
FROM cypher('graph_name', $$
RETURN 1.0
$$) AS (float_result agtype);

Numeric
SELECT *
FROM cypher('graph_name', $$
RETURN 1.0::numeric
$$) AS (numeric_result agtype);

Bool
SELECT *
FROM cypher('graph_name', $$
RETURN TRUE
$$) AS (boolean_result agtype);

String
SELECT *
FROM cypher('graph_name', $$
RETURN 'This is a string'
$$) AS (string_result agtype);

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay