Download scripts/sanitize_blank_bootstrap.awk from alm108/mycelium: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/alm108/mycelium/resolve/main/scripts/sanitize_blank_bootstrap.awk
- Command line
-
hf download hf://spaces/alm108/mycelium/scripts/sanitize_blank_bootstrap.awk
-
curl -L -o sanitize_blank_bootstrap.awk https://huggingface.co/spaces/alm108/mycelium/resolve/main/scripts/sanitize_blank_bootstrap.awk
1.32 kB
| # Convert a plain-text pg_dump into a portable, data-free structural bootstrap. | |
| # | |
| # The source is allowed to contain schema plus COPY data because this filter | |
| # treats every data-bearing statement as untrusted. The wrapper performs | |
| # input-hash and output invariant checks before replacing the destination. | |
| function emit(line) { | |
| if (line == "") { | |
| pending_blank_lines++ | |
| return | |
| } | |
| while (pending_blank_lines > 0) { | |
| print "" | |
| pending_blank_lines-- | |
| } | |
| print line | |
| } | |
| BEGIN { | |
| in_copy = 0 | |
| pending_blank_lines = 0 | |
| print "-- Portable Mycelium structural bootstrap." | |
| print "-- Generated mechanically from the verified source dump; contains no graph records." | |
| print "-- Structural schema is not a declaration of canonical semantic ontology." | |
| print "" | |
| } | |
| { | |
| sub(/\r$/, "") | |
| sub(/[ \t]+$/, "") | |
| } | |
| in_copy { | |
| if ($0 == "\\.") { | |
| in_copy = 0 | |
| } | |
| next | |
| } | |
| /^COPY / { | |
| in_copy = 1 | |
| next | |
| } | |
| /^\\(un)?restrict / { next } | |
| /^ALTER .* OWNER TO [^;]+;$/ { next } | |
| /^SELECT pg_catalog\.setval\(/ { next } | |
| /^-- Data for Name:/ { next } | |
| /^-- Name: .*; Type: TABLE DATA;/ { next } | |
| /^-- Name: .*; Type: SEQUENCE SET;/ { next } | |
| { emit($0) } | |
| END { | |
| if (in_copy) { | |
| print "unterminated COPY block" > "/dev/stderr" | |
| exit 65 | |
| } | |
| } | |