@@ -83,14 +83,37 @@ def _build_not_found_error(conn_id: str, normalized_name: str) -> str:
8383
8484 message_parts .append ("" )
8585 message_parts .append ("Searched YAML files:" )
86- for yaml_file in LIBRARY_CONNECTIONS :
86+ for yaml_file in _iter_yaml_candidates ( LIBRARY_CONNECTIONS ) :
8787 expanded = Path (yaml_file ).expanduser ()
8888 exists = " (found)" if expanded .exists () else " (not found)"
8989 message_parts .append (f" - { yaml_file } { exists } " )
9090
9191 return "\n " .join (message_parts )
9292
9393
94+ def _iter_yaml_candidates (paths : list [str ]) -> list [str ]:
95+ """Return configured YAML paths plus sibling .yml/.yaml fallbacks."""
96+ candidates : list [str ] = []
97+ seen : set [str ] = set ()
98+
99+ for raw_path in paths :
100+ expanded = str (Path (raw_path ).expanduser ())
101+ base = Path (expanded )
102+ options = [expanded ]
103+ if base .suffix .lower () == ".yml" :
104+ options .append (str (base .with_suffix (".yaml" )))
105+ elif base .suffix .lower () == ".yaml" :
106+ options .append (str (base .with_suffix (".yml" )))
107+
108+ for candidate in options :
109+ if candidate in seen :
110+ continue
111+ seen .add (candidate )
112+ candidates .append (candidate )
113+
114+ return candidates
115+
116+
94117def resolve_connection_url (conn_id_or_url : str | None ) -> str :
95118 """
96119 Resolve a connection ID to a database URL.
@@ -127,7 +150,7 @@ def resolve_connection_url(conn_id_or_url: str | None) -> str:
127150 url = resolve_connection_url("/path/to/data.csv")
128151
129152 # YAML file lookup (if not in env)
130- # Searches ~/.sqlcompare/connections.yml, then ~/.dtk/connections.yml
153+ # Searches ~/.config/ sqlcompare/connections.yaml/ .yml, then ~/.dtk/connections.yml
131154 """
132155 # Step 0: Use default connection if None (search all DEFAULT_CONN_IDS)
133156 if conn_id_or_url is None :
@@ -161,8 +184,8 @@ def resolve_connection_url(conn_id_or_url: str | None) -> str:
161184 if url_str :
162185 return url_str
163186
164- # Step 4: Search ALL YAML files (in order)
165- for yaml_path in LIBRARY_CONNECTIONS :
187+ # Step 4: Search ALL YAML files (in order), with .yml/.yaml fallback for each path
188+ for yaml_path in _iter_yaml_candidates ( LIBRARY_CONNECTIONS ) :
166189 connections = _load_connections_from_yaml (yaml_path )
167190
168191 # YAML uses raw conn_id (not normalized) for matching
0 commit comments