
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@inferagraph/sql-datasource
Advanced tools
SQL datasource for InferaGraph (PostgreSQL, MySQL, SQLite, MSSQL)
SQL datasource plugin for @inferagraph/core. Supports PostgreSQL, MySQL, SQLite, and MSSQL via Knex.js.
pnpm add @inferagraph/sql-datasource @inferagraph/core
You also need to install the driver for your chosen dialect:
# PostgreSQL
pnpm add pg
# MySQL
pnpm add mysql2
# SQLite
pnpm add better-sqlite3
# MSSQL
pnpm add tedious
import { SqlDatasource } from '@inferagraph/sql-datasource';
const datasource = new SqlDatasource({
dialect: 'postgres',
connection: {
host: 'localhost',
port: 5432,
user: 'app',
password: 'secret',
database: 'graph_db',
},
autoMigrate: true, // auto-create tables on connect
});
await datasource.connect();
const view = await datasource.getInitialView();
const node = await datasource.getNode('node-1');
const neighbors = await datasource.getNeighbors('node-1', 2); // depth>1 supported
const results = await datasource.search('keyword');
await datasource.disconnect();
getNeighbors(nodeId, depth) supports depth > 1. SQL has no native graph traversal, so the datasource does an application-level BFS — one 1-hop fan-out per level, deduping nodes and edges by id. Single-hop callers see no change.
| Option | Type | Description |
|---|---|---|
dialect | 'postgres' | 'mysql' | 'sqlite' | 'mssql' | SQL dialect |
connection | string | object | Knex connection config or connection string |
tables.nodes | string | Node table name (default: 'nodes') |
tables.edges | string | Edge table name (default: 'edges') |
tables.properties | string | EAV properties table name (default: 'node_properties') |
tables.content | string | Content table name (default: 'content') |
autoMigrate | boolean | Create tables on connect (default: false) |
When autoMigrate: true, the following tables are created:
| Column | Type | Description |
|---|---|---|
id | VARCHAR(255) | Primary key |
name | VARCHAR(500) | Node display name |
type | VARCHAR(100) | Node type |
created_at | TIMESTAMP | Creation timestamp |
updated_at | TIMESTAMP | Last update timestamp |
| Column | Type | Description |
|---|---|---|
id | VARCHAR(255) | Primary key |
source_id | VARCHAR(255) | FK to nodes.id |
target_id | VARCHAR(255) | FK to nodes.id |
type | VARCHAR(100) | Relationship type |
weight | FLOAT | Edge weight (default: 1.0) |
created_at | TIMESTAMP | Creation timestamp |
| Column | Type | Description |
|---|---|---|
node_id | VARCHAR(255) | FK to nodes.id |
key | VARCHAR(255) | Property name |
value | TEXT | Serialized value |
value_type | VARCHAR(50) | Type hint (string, number, boolean, json) |
| Column | Type | Description |
|---|---|---|
node_id | VARCHAR(255) | FK to nodes.id (PK) |
content | TEXT | Content body |
content_type | VARCHAR(50) | MIME-like type (default: 'markdown') |
metadata | TEXT | JSON string of metadata |
updated_at | TIMESTAMP | Last update timestamp |
| Dialect | Driver | Status |
|---|---|---|
| PostgreSQL | pg | Supported |
| MySQL | mysql2 | Supported |
| SQLite | better-sqlite3 | Supported |
| MSSQL | tedious | Supported |
MIT
FAQs
SQL datasource for InferaGraph (PostgreSQL, MySQL, SQLite, MSSQL)
The npm package @inferagraph/sql-datasource receives a total of 14 weekly downloads. As such, @inferagraph/sql-datasource popularity was classified as not popular.
We found that @inferagraph/sql-datasource demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.