Build the WHERE fragment that matches the table's model_repo column. Bare-name catalog entries (no '/') can land in the table as either model_repo='' or model_repo IS NULL depending on the create path, so accept both. Namespaced entries match the exact string.
(repo: str)
| 65 | |
| 66 | |
| 67 | def _sql_repo_match(repo: str) -> str: |
| 68 | """Build the WHERE fragment that matches the table's model_repo column. |
| 69 | |
| 70 | Bare-name catalog entries (no '/') can land in the table as either |
| 71 | model_repo='' or model_repo IS NULL depending on the create path, so |
| 72 | accept both. Namespaced entries match the exact string. |
| 73 | """ |
| 74 | if repo == "": |
| 75 | return "(model_repo IS NULL OR model_repo = '')" |
| 76 | return f"model_repo = '{_sql_str(repo)}'" |
| 77 | |
| 78 | |
| 79 | def main() -> None: |