From bb4f7712d222ed012b05f7cea51eac9aa39410b9 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 21 May 2026 00:43:10 -0400 Subject: [PATCH] Allow dots in identifiers and strip surrounding quotes in validate_identifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Supports iSeries schema names that contain dots (e.g. CMS.CUSLG). Strips surrounding double quotes on input so users don't need to worry about quoting — the driver's quote_identifier handles that when building SQL. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- pipekit/drivers/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pipekit/drivers/base.py b/pipekit/drivers/base.py index 2ab2e97..d9f1ae7 100644 --- a/pipekit/drivers/base.py +++ b/pipekit/drivers/base.py @@ -66,11 +66,16 @@ class RemoteColumn: # identifiers; reject everything else before it reaches a query. # --------------------------------------------------------------------------- -_SAFE_IDENT = re.compile(r"^[A-Za-z_][A-Za-z0-9_$#]*$") +_SAFE_IDENT = re.compile(r"^[A-Za-z_][A-Za-z0-9_$#.]*$") def validate_identifier(value: str, field_name: str = "identifier") -> str: - if not isinstance(value, str) or not _SAFE_IDENT.match(value): + if not isinstance(value, str): + raise ValueError(f"invalid {field_name}: {value!r}") + # Strip surrounding double quotes — caller should pass the bare name + if value.startswith('"') and value.endswith('"') and len(value) > 2: + value = value[1:-1] + if not _SAFE_IDENT.match(value): raise ValueError(f"invalid {field_name}: {value!r}") return value