{"id":20486283,"url":"https://github.com/undp-data/martin-config","last_synced_at":"2026-05-29T18:31:21.685Z","repository":{"id":111481122,"uuid":"449292747","full_name":"UNDP-Data/martin-config","owner":"UNDP-Data","description":"This repository is to manage the python script to generate config.yaml for martin server from a PostGIS database.","archived":false,"fork":false,"pushed_at":"2023-05-13T21:11:16.000Z","size":76,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T16:40:35.270Z","etag":null,"topics":["python","vector-tiles"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UNDP-Data.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-01-18T13:21:20.000Z","updated_at":"2023-08-20T13:10:59.000Z","dependencies_parsed_at":"2024-11-15T16:46:15.509Z","dependency_job_id":null,"html_url":"https://github.com/UNDP-Data/martin-config","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/UNDP-Data/martin-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UNDP-Data%2Fmartin-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UNDP-Data%2Fmartin-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UNDP-Data%2Fmartin-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UNDP-Data%2Fmartin-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UNDP-Data","download_url":"https://codeload.github.com/UNDP-Data/martin-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UNDP-Data%2Fmartin-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33666290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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":["python","vector-tiles"],"created_at":"2024-11-15T16:35:55.980Z","updated_at":"2026-05-29T18:31:21.670Z","avatar_url":"https://github.com/UNDP-Data.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# martin-config\n\nA python tool to generate config.yaml for [martin](https://github.com/maplibre/martin) vector tiles server\nfrom PostGIS database leveraging asyncpg\nlibrary. \u003cbr/\u003e \nmartin server uses a YAML config file to specify what tables/functions from the PostGIS DB\nwill be published. \n\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n\n##Features\n\n---\n\nmartin-config uses asyncpg to interact with the Postgres server and supports following functionality:\n- [x] creating config for table sources\n- [x] creating config for function sources\n- [x] creating config for  the general section\n- [x] operate in one, multiple or all schemas\n- [x] selective publishing of tables through table comments\n- [x] selective publishing of columns through column comments\n- [x] uploading the config file to an Azure File Share using  SAS authentication\n\nIts strongest feature is the ability to select only the mark tables and table columns.\nThis is achieved by inserting the \n\n\n```publish=True/False```.\n\ninto the comment of a given table/column. The folowing rules apply\n- if a table does not have this string in the comments it is considered unmarked and unpublishable\n- if a has this string in comments its value dictates if the table is publishable (True) or unpublishable (False)\n- same logic applied to columns with the difference that unmarked columns are **publishable by default**\n\nThis allows users to mark/set the tables/columns selectively and use martin-config  to generate \na conforming config file.\n\n## Requirements\n\n---\n\nasyncpg, yaml, dotenv and optionally azure-file-share\n\n## Install\n\n---\n\n1. Create a pipenv based venv\n```bash\npython3 -m pip install pipenv\npipenv --python 3\n```\n2. install martin-config\n```commandline\npipenv run pip install martin-config\n```\n3. optionally install azure functionality to be able to upload the cfg to AFS\n```commandline\npipenv run pip install martin-config[azure]\n```\n\n## Usage\n\n---\nthe installer creates a command line script **martincfg**\n\nwith pipenv it can be invoked like this:\n\n```commandline\npipenv run martincfg\n```\n\n\n```bash\npipenv run martincfg\nLoading .env environment variables...\nusage: martincfg [-h] [-s DATABASE_SCHEMA [DATABASE_SCHEMA ...]] [-o OUT_CFG_FILE] [-e ENV_FILE] [-d] [-sfs]\n\nCreate a config file for martin vector tile server\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -s DATABASE_SCHEMA [DATABASE_SCHEMA ...], --database-schema DATABASE_SCHEMA [DATABASE_SCHEMA ...]\n                        A list of schema names. If no schema is specified all schemas are used.\n  -o OUT_CFG_FILE, --out-cfg-file OUT_CFG_FILE\n                        Full path to the config file to be created. If not supplied the YAML fill be dumped to stdout\n  -e ENV_FILE, --env-file ENV_FILE\n                        Load environmental variables from .env file\n  -d, --debug           Set log level to debug\n  -sfs, --skip-function-sources\n                        Do not create config for function sources\n\n```\n\n\n## Environmental variables\nThe arguments are self-explanatory. However, environmental variables\nare also required to be available at runtime, specifically:\n\n```bash\n POSTGRES_DSN=postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1\u0026...]\n \n AZURE_FILESHARE_SASURL=https://[storageaccount].file.core.windows.net/[sharename]?[SAS_QUERY_STRING]\n```\n***Tips:*** \u003cbr/\u003e\n- If no schema is specified all schemas are used.\n- multiple schemas can be specified one after another ``public myschema`` or ``public,myschema``\n- .env file containing the above environmental variable can be used to the same effect as defining env. variables \n\nFor improving the performance of the script, please create statistics for all tables by the following SQL.\n\n```sql\n-- analyze all tables\nANALYZE;\n\n-- analyze specific table\nANALYZE schema.tablename;\n```\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundp-data%2Fmartin-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fundp-data%2Fmartin-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundp-data%2Fmartin-config/lists"}