{"record":{"id":"27979ebc198d9a71","repo":"cocoindex-io/cocoindex","slug":"invalid-identifier-name","errorCode":null,"errorMessage":"Invalid identifier: {name}","messagePattern":"Invalid identifier: (.+?)","errorType":"exception","errorClass":"DorisSchemaError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/doris/_target.py","lineNumber":490,"sourceCode":"    async def close(self) -> None:\n        if self._session is not None and not self._session.closed:\n            await self._session.close()\n            self._session = None\n\n\ndef connect(config: DorisConnectionConfig) -> ManagedConnection:\n    \"\"\"Create a ManagedConnection from a DorisConnectionConfig.\"\"\"\n    return ManagedConnection(config=config)\n\n\n# ============================================================\n# SQL helpers\n# ============================================================\n\n\ndef _validate_identifier(name: str) -> None:\n    if not re.match(r\"^[a-zA-Z_][a-zA-Z0-9_]*$\", name):\n        raise DorisSchemaError(f\"Invalid identifier: {name}\")\n\n\ndef _convert_to_key_column_type(doris_type: str) -> str:\n    if doris_type in (\"TEXT\", \"STRING\"):\n        return \"VARCHAR(512)\"\n    return doris_type\n\n\ndef _convert_value_for_doris(value: Any) -> Any:\n    if value is None:\n        return None\n    if isinstance(value, uuid.UUID):\n        return str(value)\n    if isinstance(value, float) and math.isnan(value):\n        return None\n    if isinstance(value, (list, tuple)):\n        return [_convert_value_for_doris(v) for v in value]\n    if isinstance(value, dict):","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/doris/_target.py#L472-L508","documentation":"Identifiers used in generated SQL (table, column, vector field, database names) must match ^[a-zA-Z_][a-zA-Z0-9_]*$. Anything containing dashes, dots, spaces, unicode, or starting with a digit would allow SQL injection or produce invalid Doris DDL, so _validate_identifier raises DorisSchemaError.","triggerScenarios":"Creating a table whose column names derive from record fields with non-identifier names (e.g. 'user-id', '2nd_col'); calling build_vector_search_query with a table/field name containing hyphens or dots; _execute_delete with a PK column name containing invalid characters.","commonSituations":"Deriving column names from file names or JSON keys that contain dashes/spaces; using quoted or schema-qualified names like 'db.table' where a bare identifier is expected.","solutions":["Rename the field/column to a valid SQL identifier (letters, digits, underscore; not starting with a digit)","Use an explicit column name override that is a valid identifier for fields with awkward names","Sanitize/normalize names (e.g. re.sub to underscores) before building the schema"],"exampleFix":"// before\nclass Row: \"user-id\": str\n// after\nclass Row: user_id: str = res_schema.field(column_name=\"user_id\")","handlingStrategy":"validation","validationCode":"import re\ndef safe_ident(name): \n    assert re.fullmatch(r\"[a-zA-Z_][a-zA-Z0-9_]*\", name), f\"bad identifier: {name}\"\n    return name","typeGuard":null,"tryCatchPattern":"try:\n    q = build_vector_search_query(table=t, ...)\nexcept (DorisSchemaError, ValueError):\n    t = re.sub(r\"\\W\", \"_\", t)","preventionTips":["Name record fields as valid SQL identifiers","Provide explicit column_name overrides for awkward field names","Never pass dotted/quoted names where a bare identifier is expected"],"tags":["doris","sql","identifier","validation"],"backgroundTag":"invalid-identifier-format","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}