Skip to content

Instantly share code, notes, and snippets.

@vergenzt
Created March 2, 2026 19:05
Show Gist options
  • Select an option

  • Save vergenzt/9871577c72ec02123f23c3c31c18e908 to your computer and use it in GitHub Desktop.

Select an option

Save vergenzt/9871577c72ec02123f23c3c31c18e908 to your computer and use it in GitHub Desktop.
Failure to load partial_parse.msgpack: `int is not allowed for map key when strict_map_key=True`
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "dbt-core==1.11.6",
# "dbt-postgres==1.10.0",
# ]
# ///
from contextlib import chdir
import json
import os
import re
from tempfile import TemporaryDirectory
from subprocess import check_call as sh
from pathlib import Path
from textwrap import dedent
def main() -> None:
with TemporaryDirectory() as tmpdir, chdir(tmpdir):
os.environ["DBT_PROJECT_DIR"] = tmpdir
os.environ["DBT_PROFILES_DIR"] = tmpdir
os.environ["DO_NOT_TRACK"] = "1"
Path("profiles.yml").write_text(
dedent("""
test_profile:
outputs:
default:
type: postgres
host: '{{ env_var("DB_HOST", "") }}'
user: '{{ env_var("DB_USERNAME", "") }}'
password: '{{ env_var("DB_PASSWORD", "") }}'
port: '{{ env_var("DB_PORT", "0") | as_native }}'
dbname: '{{ env_var("DB_NAME", "") }}'
schema: '{{ env_var("DB_SCHEMA", "") }}'
""")
)
Path("dbt_project.yml").write_text(
dedent("""
name: test_project
version: '0.1'
profile: test_profile
model-paths: ["models"]
models:
test_project:
+meta:
my_meta_key:
0: foo
1: bar
""")
)
Path("models").mkdir()
Path("models/mymodel.sql").write_text("select 1")
print("=== PARSE #1 ===")
sh(["dbt", "parse"])
print()
print("=== PARSE #2 ===")
sh(["dbt", "parse", "--debug"])
assert any(
re.search(
"Failed to load parsed file from disk at .*: int is not allowed for map key when strict_map_key=True",
line,
)
for line in Path("logs/dbt.log").read_text().splitlines()
)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment