{"id":36374895,"url":"https://github.com/mapbender/query-builder","last_synced_at":"2026-01-11T14:10:38.731Z","repository":{"id":55993016,"uuid":"57110960","full_name":"mapbender/query-builder","owner":"mapbender","description":"SQL Query Builder Element","archived":false,"fork":false,"pushed_at":"2025-09-17T12:25:14.000Z","size":176,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-09-17T14:34:26.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mapbender.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-04-26T08:22:51.000Z","updated_at":"2025-06-12T09:51:42.000Z","dependencies_parsed_at":"2025-09-17T14:32:45.952Z","dependency_job_id":null,"html_url":"https://github.com/mapbender/query-builder","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/mapbender/query-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbender%2Fquery-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbender%2Fquery-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbender%2Fquery-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbender%2Fquery-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbender","download_url":"https://codeload.github.com/mapbender/query-builder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbender%2Fquery-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28306986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T11:18:18.743Z","status":"ssl_error","status_checked_at":"2026-01-11T11:07:56.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-11T14:10:38.176Z","updated_at":"2026-01-11T14:10:38.725Z","avatar_url":"https://github.com/mapbender.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mapbender QueryBuilder\n\nThe QueryBuilder is a Mapbender element. It is a query tool and enables the integration, display and editing of SQL queries and their result visualisation and export via the application interface. \n\n## Mapbender\nSee [Official site](https://mapbender.org/?q=en) | [Live demo](https://demo.mapbender.org/) | [News on Fosstodon](https://fosstodon.org/@mapbender)\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5887014.svg)](https://doi.org/10.5281/zenodo.5887014)\n![Packagist License](https://img.shields.io/packagist/l/mapbender/mapbender)\n\n## Installation\nUse `composer require mapbender/query-builder` and register MapbenderQueryBuilderBundle with the Symfony application kernel.\n\n\n## Contributing\n\nPlease read official [contibuting documentation](https://github.com/mapbender/mapbender-starter/blob/master/CONTRIBUTING.md)\n\n\n## QueryBuilder Functionality\n\nYou can use the QueryBuilder element in the sidepane. \n\nDepending on the settings, the QueryBuilder allows you to \n\n* create, edit and delete queries\n* execute queries \n* output as Html\n* Display in dialog\n* Export to Excel\n* Search \n\nThe respective authorizations for the query options can be assigned in the configuration of the element\n\n\n### Configuration\n\nYou need an administration table in your database where you store your sql definitions (see example below).\n\n* **Title:** Title of the element.\n* **Configuration:** YAML-Field to define the connection and settings for the administration table:\n  * **connection:** database connection name (as defined in `doctrine.yaml`, default: `default`)\n  * **table:** administration table name where the queries are stored (required)\n  * **uniqueId:** refer to the unique id of the table (default: `id`)\n  * **titleFieldName:** name to display for the SQL query. Appears later in the SQL query table as the title. (default: `name`)\n  * **sqlFieldName:** table column with the SQL query (default: `sql_definition`)\n  * **orderByFieldName:** table column for specifying the order in the SQL query table (default: `id`)\n  * **connectionFieldName:** table column with the database connection for the SQL query (default: the same connection as given in `connection`)\n  * **filter:** definition of a filter if not all queries should be visible as sql WHERE query, e.g. `active = 1` (optional)\n  * **export_format:**: file type for the file export: `xlsx` (default), `xls` or `csv`\n\nExample:\n\n```yaml\n   connection: geodata_db    \n   table: query_builder_data   \n   uniqueId: id\n   titleFieldName: name\n   sqlFieldName: sql_definition\n   orderByFieldName: ordering\n   connectionFieldName: connection_field_name\n   filter: 'active is not null'\n   export_format: xlsx\n```\n\nThere are also some options that you can configure:\n\n* **Allow execute:** If checked, users can execute the query to show the results in a popup (default: `true`).\n* **Allow search:** If checked, users can filter the query list and popup results by a search string (default: `false`).\n* **Allow HTML export:** If checked, users can view the data as a printable HTML page in a new window (default: `true`)\n* **Allow file export:** If checked, users can download the query results as a spreadsheet file (xlsx, xls or csv depending on configuration; default: `true`)\n\nYou can either modify the queries directly in the database, the query builder also supports manipulating the data directly in mapbender. Since allowing users to modify arbitrary SQL is a potential security threat, in addition to checking the respective checkboxes, users with edit rights also need to be granted a global permission (Security - Global Permissions - QueryBuilder). \n\nIn addition to the permissions, the databases that allow executing query builder queries need to be defined in the `parameters.yaml` file using the parameter `querybuilder_allowed_connections`, e.g.\n\n```yaml\nparameters:\n    querybuilder_allowed_connections:\n        - default\n        - geodata\n```\n\nThe following configuration entries toggle the availability of editing functionality:\n\n* **Allow save:** If checked, users with the permission QueryBuilder.edit can modify existing queries (default: `false`). \n* **Allow create:** If checked, users with the permission QueryBuilder.create can add new queries (default: `false`).\n* **Allow remove:** If checked, users with the permission QueryBuilder.remove can remove existing queries (default: `false`).\n\n\n### Administration table to store the query definitions and metadata\n\nThis administration table can be created in an existing database using the following SQL command. This is just an example, you can choose the column names freely, just adjust the configuration accordingly.\n\n```\nCREATE TABLE public.query_builder_data (\n   id serial PRIMARY KEY,\n   name character varying,\n   sql_definition text,\n   active integer,\n   ordering integer,\n   connection_field_name character varying\n);\n```\n\nThe following demodata with SQL queries can be used for the exemplary use.\nThe SQL commands for the creation of the queried tables can be found in the documentation for the digitizer element.\n\n```                \nINSERT INTO public.query_builder_data (id, name, sql_definition, active, ordering, connection_field_name) VALUES (1, 'Report 1: Time and Date', 'Select now() as \"Zeit\", date(now()) as \"Datum\";', 1, 1, 'geodata_db');\nINSERT INTO public.query_builder_data (id, name, sql_definition, active, ordering, connection_field_name) VALUES (3, 'Report 2: Mapbender applications', 'Select id, title, slug from mb_core_application;', 1, 4, 'default');\nINSERT INTO public.query_builder_data (id, name, sql_definition, active, ordering, connection_field_name) VALUES (4, 'Report 3: Mapbender users', 'Select id, username from fom_user;', 1, 3, 'default');\nINSERT INTO public.query_builder_data (id, name, sql_definition, active, ordering, connection_field_name) VALUES (2, 'Hello world', 'Select now() as \"Zeit\", date(now()) as \"Datum\", ''Hello world!'' as gruss;', 1, 2, 'default');\n```\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbender%2Fquery-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbender%2Fquery-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbender%2Fquery-builder/lists"}