Package: martin-config
martin-configA python tool to generate config.yaml formartinvector tiles server
from PostGIS database leveraging asyncpg
library.martin server uses a YAML config file to specify what tables/functions from the PostGIS DB
will be published.FeaturesRequirementsInstallationUsage##Featuresmartin-config uses asyncpg to interact with the Postgres server and supports following functionality:creating config for table sourcescreating config for function sourcescreating config for  the general sectionoperate in one, multiple or all schemasselective publishing of tables through table commentsselective publishing of columns through column commentsuploading the config file to an Azure File Share using  SAS authenticationIts strongest feature is the ability to select only the mark tables and table columns.
This is achieved by inserting thepublish=True/False.into the comment of a given table/column. The folowing rules applyif a table does not have this string in the comments it is considered unmarked and unpublishableif a has this string in comments its value dictates if the table is publishable (True) or unpublishable (False)same logic applied to columns with the difference that unmarked columns arepublishable by defaultThis allows users to mark/set the tables/columns selectively and use martin-config  to generate
a conforming config file.Requirementsasyncpg, yaml, dotenv and optionally azure-file-shareInstallCreate a pipenv based venvpython3-mpipinstallpipenv
pipenv--python3install martin-configpipenv run pip install martin-configoptionally install azure functionality to be able to upload the cfg to AFSpipenv run pip install martin-config[azure]Usagethe installer creates a command line scriptmartincfgwith pipenv it can be invoked like this:pipenv run martincfgpipenvrunmartincfg
Loading.envenvironmentvariables...
usage:martincfg[-h][-sDATABASE_SCHEMA[DATABASE_SCHEMA...]][-oOUT_CFG_FILE][-eENV_FILE][-d][-sfs]Createaconfigfileformartinvectortileserver

optionalarguments:-h,--helpshowthishelpmessageandexit-sDATABASE_SCHEMA[DATABASE_SCHEMA...],--database-schemaDATABASE_SCHEMA[DATABASE_SCHEMA...]Alistofschemanames.Ifnoschemaisspecifiedallschemasareused.-oOUT_CFG_FILE,--out-cfg-fileOUT_CFG_FILEFullpathtotheconfigfiletobecreated.IfnotsuppliedtheYAMLfillbedumpedtostdout-eENV_FILE,--env-fileENV_FILELoadenvironmentalvariablesfrom.envfile-d,--debugSetlogleveltodebug-sfs,--skip-function-sourcesDonotcreateconfigforfunctionsourcesEnvironmental variablesThe arguments are self-explanatory. However, environmental variables
are also required to be available at runtime, specifically:POSTGRES_DSN=postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]AZURE_FILESHARE_SASURL=https://[storageaccount].file.core.windows.net/[sharename]?[SAS_QUERY_STRING]Tips:If no schema is specified all schemas are used.multiple schemas can be specified one after anotherpublic myschemaorpublic,myschema.env file containing the above environmental variable can be used to the same effect as defining env. variablesFor improving the performance of the script, please create statistics for all tables by the following SQL.-- analyze all tablesANALYZE;-- analyze specific tableANALYZEschema.tablename;