• Stars
    star
    387
  • Rank 107,586 (Top 3 %)
  • Language
    Common Lisp
  • Created almost 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Turn your PostgreSQL queries into Charts

PostgreSQL Charts

Screen Shots

It's intended as a visual project. Here's what it looks like.

Query editing pane

pgcharts-query

Chart pane

pgcharts-bar-chart

Query listing pane

pgcharts-query-list

Chart only pane

So that you can give an URL to just the chart for your coworkers to see (and download as a PDF, PNG, JPEG or SVG document):

pgcharts-chart

Description

The pgcharts projects is a little web application that takes as input an SQL query text and outputs its data in one of the following forms:

  • HTML table
  • Column Chart
  • Bar Chart
  • Pie Chart
  • Donut Chart

With more to come (TODO):

  • Area Chart
  • Line Chart
  • Stacked Area Chart
  • Stacked Bar Chart
  • Grouped Bar Chart
  • CSV file

Initial Setup

The pgcharts application needs its own PostgreSQL database to be able to register user queries and their charts setup:

$ createdb pgcharts
$ pgcharts setup pgsql://localhost/pgcharts

Then you can start the service, which defaults to listening to http://localhost:9042/:

$ pgcharts start
$ open http://localhost:9042/

Now, you can use pgcharts from your browser. Issue new query, save them away, and see nice charts from their results!

Registering databases

Once the pgcharts database has been created, it's necessary to register the database servers you want to run queries against:

$ pgcharts register pgsql://user:pass@host/dbname
$ pgcharts register pgsql://user:pass@host/seconddbname?sslmode=require

The sslmode option accepts the following values: disable, allow, prefer and require. The allow and prefer options are implements in the same way, translating to the Postmodern PostgreSQL driver's value :try, where :try means if the server supports it.

Implementation

pgchart needs a database where to handle its own data, as it is storing a list of database connections (where to run the queries) and a list of queries (with a name and a tags list).

TODO: see about storing query results on the pgcharts database so that it's possible to get back to them later. Maybe with some ways to run the query again and compare?

Security

The pgcharts web service offers no security implementation, no user role management or privileges. To keep the service secure, users are only allowed to query against registered database servers.

To register a database server to pgcharts, the command line interface must be used, so only the service administrator is in a position to register new database servers.

Usage

pgcharts is a self-contained web application. As such, when you start the command line application, it starts its own web server that you can connect to.

Install

The pgcharts application has been written in Common Lisp and uses a bunch of librairies that are available through the Quicklisp distribution system. The included Makefile cares about building a self-contained binary for you, and can be used as following:

$ <install recent sbcl>
$ make
$ ./build/bin/pgcharts --help

Note that the self-contained binary also includes static web resources such as jquery, bootstrap, Highcharts and codemirror.

Build Dependencies

You need a recent enough SBCL Common Lisp compiler to be able to compile pgcharts. It's easy to install on Linux, MacOSX and Windows.

debian$ sudo apt-get install sbcl
centos$ sudo yum install sbcl
macosx$ brew install sbcl

More Repositories

1

pgloader

Migrate to PostgreSQL in a single command!
Common Lisp
5,092
star
2

el-get

Manage the external elisp bits and pieces upon which you depend!
Emacs Lisp
1,641
star
3

pgcopydb

Copy a Postgres database to a target Postgres server (pg_dump | pg_restore on steroids)
C
1,039
star
4

switch-window

Offer a *visual* way to choose a window to switch to
Emacs Lisp
288
star
5

regresql

Regression Testing your SQL queries
Go
254
star
6

emacs-kicker

A minimal kick start init file for emacs
Emacs Lisp
145
star
7

prefix

Prefix Range module for PostgreSQL
C
96
star
8

pgextwlist

PostgreSQL Extension Whitelisting
C
92
star
9

sudoku

Solving Every Sudoku Puzzle
Python
58
star
10

preprepare

PostgreSQL prepare statements made pooling friendly
C
45
star
11

tpch-citus

Drivers to run TPC-H with Citus and PostgreSQL
C
31
star
12

nba

Aggregating NBA data
Common Lisp
30
star
13

pg_staging

Setup and maintain your staging environments from your production backups!
Python
28
star
14

cssh

ClusterSSH meets Emacs
Emacs Lisp
27
star
15

cl-abnf

ABNF Parser Generator, per RFC2234
Common Lisp
27
star
16

pgdevenv-el

PostgreSQL Development Tool for Emacs
Emacs Lisp
23
star
17

ql-to-deb

Update cl-* debian packages from Quicklisp releases.
Common Lisp
23
star
18

mbsync-el

Wrap calling mbsync in Emacs Lisp, with a gnus hook
Emacs Lisp
23
star
19

libphp-pgq

PHP level API for PGQ PostgreSQL Queing solution
PHP
17
star
20

pg_basebackup

Make your PostgreSQL base backup from a plain connection to the server (as superuser)
Python
17
star
21

kids

Helping kids discover computing
Common Lisp
16
star
22

base36

PostgreSQL base36 data type input/output support, internally a bigint.
C
14
star
23

getddl

Get the DDL from a live database and split them in files and directories
Python
14
star
24

tapoueh.org

Sources of the tapoueh.org web site, using Hugo
HTML
13
star
25

taop.xyz

The Art of PostgreSQL
HTML
13
star
26

apt.postgresql.org

debian packaging scripts for PostgreSQL.org
Shell
12
star
27

pginstall

The PostgreSQL Extension Installer
Common Lisp
11
star
28

emacs.d

My Emacs Setup
Emacs Lisp
9
star
29

pgsql-linum-format

a linum-mode hook to display PostgreSQL functions line numbers
Emacs Lisp
8
star
30

pgconfs

dim's PostgreSQL Conferences Slides, the sources.
PostScript
8
star
31

cl-db3

A Common Lisp lib to read dbf files version 3.
Common Lisp
7
star
32

pubnames

The Most Popular Pub Names
Common Lisp
7
star
33

subcommands.c

Another single-file header C lib: command line, file paths manipulation API, run subprograms.
C
7
star
34

AdventOfCode

Implementation of Advent Of Code puzzles in Common Lisp, just for fun.
Common Lisp
7
star
35

masteringpostgresql.com

My new book, still in the making.
CSS
7
star
36

plconvert

Convert code in between non standard database Procedural Languages.
Common Lisp
6
star
37

mailq-el

Emacs major mode for `mailq' interaction
Emacs Lisp
5
star
38

toy-parser

How to build a parser and have a compiler for free, in Common Lisp.
Common Lisp
5
star
39

mysqltopgsql.com

How to migrate from MySQL to PostgreSQL
HTML
5
star
40

pgsrc-el

PostgreSQL source editing facilities for Emacs
Emacs Lisp
3
star
41

rcirc-groups

an emacs buffer in rcirc-groups major mode
Emacs Lisp
3
star
42

cl-ixf

Parse IBM IXF file format.
Common Lisp
2
star
43

go-hello-world

Concurrent Hello World, in Common Lisp
Common Lisp
2
star
44

artisan-mysql

Common Lisp Native Driver for MySQL
Common Lisp
2
star
45

preventddl

set preventddl.enable to true;
PLpgSQL
1
star
46

pgaf_debian

debian packaging for apt.pg.o for pg_auto_failover
1
star
47

cl-pgdumpfile

Common Lisp library that knows how to read a PostgreSQL dump file in custom format.
Common Lisp
1
star
48

Citus-tutorial

Automate the Citus tutorial steps into a single command.
Makefile
1
star
49

pgloader.io

Public Website for the pgloader project.
SCSS
1
star