Cube.js Tiva Postgres Driver

0.0.7 · maintenance · verified Wed Apr 22

The `cubejs-tiva-postgres-driver` package is a pure JavaScript PostgreSQL database driver specifically designed for the Cube.js analytics API platform. It is a fork of the official Cube.js PostgreSQL driver, currently at version `0.0.7`. This driver enables a Cube.js backend to connect and query PostgreSQL databases. Due to its status as a fork and early version number, it likely has an irregular release cadence dictated by the needs of its maintainers rather than a public schedule. Key differentiators include its "pure JavaScript" implementation for PostgreSQL connectivity within Cube.js, and potential custom modifications unique to the "Tiva" project. It targets Node.js environments from version 14.0.0 upwards and ships with TypeScript type definitions for improved developer experience.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to integrate the `cubejs-tiva-postgres-driver` into a basic Cube.js backend configuration using environment variables for database credentials and enabling SSL.

import { CubejsServer } from '@cubejs-backend/server';
import { PostgresDriver } from 'cubejs-tiva-postgres-driver';

const server = new CubejsServer({
  // Replace with your Cube.js configuration, e.g., queryRewrite, externalRefresh
  // For full configuration options, refer to the Cube.js documentation.
  
  driverFactory: (context) => {
    // The context object can be used to pass dynamic information if needed.
    console.log('Initializing Tiva Postgres Driver for Cube.js context:', context);
    return new PostgresDriver({
      host: process.env.DB_HOST ?? 'localhost',
      port: parseInt(process.env.DB_PORT ?? '5432', 10),
      user: process.env.DB_USER ?? 'cube',
      password: process.env.DB_PASSWORD ?? 'password',
      database: process.env.DB_NAME ?? 'cube_db',
      ssl: process.env.DB_SSL === 'true', // Set DB_SSL to 'true' for SSL connection
    });
  },
  // Additional Cube.js options can go here, e.g., `apiSecret`, `schemaPath`
});

server.listen().then(({ app, port }) => {
  console.log(`🚀 Cube.js server is listening on http://localhost:${port}`);
  console.log('Access your Cube.js playground at /cubejs-api');
});

view raw JSON →