{"id":28556461,"url":"https://github.com/kmoppel/pgzebra","last_synced_at":"2026-01-31T02:01:45.495Z","repository":{"id":24673367,"uuid":"28083907","full_name":"kmoppel/pgzebra","owner":"kmoppel","description":"Simple RESTful interface to single PostgreSQL tables","archived":false,"fork":false,"pushed_at":"2016-01-06T11:48:03.000Z","size":1884,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-06T17:43:44.764Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kmoppel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-16T11:24:10.000Z","updated_at":"2020-05-02T10:49:07.000Z","dependencies_parsed_at":"2022-08-23T05:01:02.779Z","dependency_job_id":null,"html_url":"https://github.com/kmoppel/pgzebra","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kmoppel/pgzebra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmoppel%2Fpgzebra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmoppel%2Fpgzebra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmoppel%2Fpgzebra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmoppel%2Fpgzebra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmoppel","download_url":"https://codeload.github.com/kmoppel/pgzebra/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmoppel%2Fpgzebra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28926630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T22:32:35.345Z","status":"online","status_checked_at":"2026-01-31T02:00:09.179Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T06:30:39.458Z","updated_at":"2026-01-31T02:01:45.476Z","avatar_url":"https://github.com/kmoppel.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"pgzebra\n=======\n\nSimple RESTful interface to single PostgreSQL tables.\n\nIt's a simplistic URL-based data viewing and graphing tool that is easy to setup and use, reflecting table data in a REST-ful way. Only a single table's data is shown at one time. \nIdea also tries to minimize typing by providing some convenience features like matching of db/table names from partially inputted names + default sorting and limiting.\n\n## Techology stack\n\n* Python2\n    - CherryPy web framework\n    - Jinja2 templating\n    - psycopg2 Postgresql driver\n    - Pygal for png graphing (optional)\n    - pyyaml for parsing the webapp's config file\n* jQuery\n* DataTables - jQuery plugin for sortable/searchable/pageable tables\n* Flot Charts\n* Bootstrap\n\n\n## Input syntax [ URL based ]\n\n\n#### Basic usage\n\n` / somedb / sometable `\n\n\n#### Filtering\n\n` / somedb / sometable / somecolumn / comparison_operator / value `\n\n* all URL segments of 3 [when 1st seg. not conflicting with a few reserved keywords ] are handled as filter\n* multiple filters possible\n* for date columns some special shortcuts can be used\n\n    - current_month (beginning date), current_week (beginning date), current_day/current_date, current_timestamp/now\n    - -/+X(days|hours|minutes|seconds)  e.g. - / created / \u003e= /-5days =\u003e WHERE order_created \u003e= current_date - '5 days'::interval\n\n#### Limiting\n\n` / somedb / sometable / l[imit] / value `\n\n\n#### Ordering\n\n` / somedb / sometable / o[rderby] ` - 1st column will be used + default sort order from the config\n\n` / somedb / sometable / o[rderby] / [ a[sc] | d[esc] ] ` - 1st column with explicit ordering\n\n` / somedb / sometable / o[rderby] / somecol / [ a[sc] | d[esc] ] ` - single column ordering with explicit ordering\n\n` / somedb / sometable / o[rderby] / somecol1[,somecol2,..] ` - multicolumn ordering\n\n\n#### Simple aggregations\n\n` / somedb / sometable / agg / agg_func / somecol ` - where agg_func in ['count', 'sum', 'min', 'max']\n\n\n#### Simple graphing\n\n###### Line graph of single column's counts over time, with month to minute grouping ($graphbucket param). The $graphkey column needs to be of type date/timestamp!\n\n` / somedb / sometable / f[ormat] / g[raph] / l[ine] / [ gk | graphkey] / temporal_col / [ gb | graphbucket ] / [month|day|hour|min|minute] `\n\n###### Pie graph showing distribution of provided column's values. The column can be of any type.\n\n` / somedb / sometable / f[ormat] / g[raph] / p[pie] / [ gk | graphkey] / somecol `\n\n` / somedb / sometable / f[ormat] / g[raph] / p[pie] / [ gk | graphkey] / somecol / l[imit] / value`\n\n**NB! For aggregates and graphs also filters can (and should) be used.** For pie graphs \"limit\" also works.\n\n\n## Output formats\n\n* HTML table [ default ]\n* JSON - ` / f[ormat] / j[son] `\n* CSV - ` / f[ormat] / c[sv] `\n* Graph - HTML + JS based - ` / f[ormat] / g[raph] `\n* Graph - pure PNG ` / f[ormat] / png `\n\n\n## Sample inputs and outputs (output of query by default shown in the datagrid)\n \n**/somedb/tablename_excerpt**\n\nThe simplest usecase. database/table names don't have to be precise, only excerpts will do, given they're precise enough to uniquely identify a table 1st matching column is used. as a wildcard '*' can be used\n\n\u003e SELECT col1,colX,.. FROM schema.table_full_name LIMIT 20\n\n\n**/somedb/order/created/\u003e/current_date**\n    \n\u003e SELECT col1,colX,.. FROM schema.order_history WHERE oh_created \u003e current_date LIMIT 10\n\nUsage of filtering. All groups of 3 parameters [starting with non-reserved keywords] are handled as filters. Multiple filters possible.\n\nNB! Currently filters are passed to the DB \"as is\" but SQL injection shouldn't still be possible due to countermeasures.\n\n**/somedb/order/created/\u003e/current_date/o/c**\n    \n\u003e SELECT col1,colX,.. FROM schema.order_history WHERE oh_created \u003e current_date ORDER BY o_created DESC LIMIT 10\n\nNB! \"/o/c\" i.e. \"o[rderby] / [c[reated]|m[odified]]\" is a Pgzebra concept of ordering by first column matching predefined [see pgzebra.yaml] created/modified patterns\n\nDefault \"LIMIT\" (here 10) comes also from the pgzebra.yaml\n\n\n**/somedb/order/created/\u003e/current_date/orderby/created/l/10**\n\n\u003e SELECT col1,colX,.. FROM schema.order_history WHERE oh_created \u003e current_date ORDER BY o_created DESC LIMIT 10\n\nThe same as previous in longer format + explicit \"LIMIT\". NB! Default \"ORDER BY\" direction is \"DESC\" - can be changed from config file\n\n\n**/somedb/order/o/a**\n\n\u003e SELECT o_id,colX,.. FROM schema.order_history ORDER BY o_id ASC LIMIT 10\n\nSimple select with ascending primary key ordering [given that PK is the 1st columns]\n\n\n**/somedb/order/agg/count/id/created/\u003e/current_date**\n\n\u003e SELECT count(o_id) FROM schema.order_history WHERE oh_created \u003e current_date\n\nSimple aggregates support is provided. Multiple aggregates can be used in one query.\n\n* count\n* sum\n* min\n* max\n\n\n**/somedb/order/f/g/line/gk/created/gb/month/created/\u003e/current_date**\n\n\u003e SELECT date_trunc('month', oh_created), count(*) FROM order_history WHERE oh_created \u003e current_date GROUP BY 1 ORDER BY 1\n\nDisplays a \"line graph\" of counts of \"graphkey\" over timeslots specified by \"graphbucket\" column. Filtering is possible as usual.\n\nNB! Missing buckets will be filled with 0-s.\n\n\n**/somedb/order/f/g/pie/gk/country/created/\u003e/current_date**\n\n\u003e SELECT oh_country, count(*) FROM order_history WHERE oh_created \u003e current_date GROUP BY 1 ORDER BY 2 DESC LIMIT 10\n\nNB! Displays a \"pie graph\" of $graphkey's distribution. Values not fitting into \"limit\" will be summarized into \"Other\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmoppel%2Fpgzebra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmoppel%2Fpgzebra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmoppel%2Fpgzebra/lists"}