This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| # Usage: ./rsid.zsh [optional_path] [--verbose] | |
| # Get the directory path from the argument or use the current directory | |
| DIR_PATH=${1:-$(pwd)} | |
| # Check for the --verbose flag | |
| VERBOSE=false | |
| if [[ "$2" == "--verbose" ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH metric_info AS ( | |
| SELECT m.name AS object_name, p.name AS column_name, metrics.metric_id, m.type AS object_type, metrics.description, metrics.name as FriendlyColName | |
| FROM sqlite_master AS m | |
| JOIN pragma_table_info(m.name) AS p | |
| LEFT JOIN metrics on p.name = metrics.field_name | |
| WHERE m.type IN ('table', 'view') -- both tables and views | |
| and m.name IN (select table_name FROM gpkg_contents) -- only tables/views registered as geopackage layers | |
| ) |