{"record":{"id":"9a8d6328e670d404","repo":"lancedb/lancedb","slug":"function-catalog-operations-are-not-supported-for","errorCode":null,"errorMessage":"Function catalog operations are not supported for this connection type","messagePattern":"Function catalog operations are not supported for this connection type","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/python/lancedb/db.py","lineNumber":710,"sourceCode":"        \"\"\"\n        raise NotImplementedError(\"serialize is not supported for this connection type\")\n\n    def create_function(self, definition: UdfDefinition) -> FunctionVersion:\n        \"\"\"Register a scalar Python UDF and wait for its immutable version.\n\n        This is the blocking counterpart of :meth:`create_function_async`.\n        Local connections raise ``NotImplementedError``.\n        \"\"\"\n        return self.create_function_async(definition).wait()\n\n    def create_function_async(self, definition: UdfDefinition) -> Job[FunctionVersion]:\n        \"\"\"Register a scalar Python UDF through the remote Function catalog.\n\n        Submission returns a typed job. The immutable Function version becomes\n        available only when :meth:`Job.wait` succeeds. Local connections raise\n        ``NotImplementedError``.\n        \"\"\"\n        raise NotImplementedError(\n            \"Function catalog operations are not supported for this connection type\"\n        )\n\n    def get_function(self, name: str, *, version: str) -> FunctionVersion:\n        \"\"\"Open one exact immutable Function version from the remote catalog.\"\"\"\n        raise NotImplementedError(\n            \"Function catalog operations are not supported for this connection type\"\n        )\n\n    def list_functions(self) -> List[FunctionVersion]:\n        \"\"\"List every published immutable Function version.\n\n        Results are ordered by Function name then version. Local connections\n        raise ``NotImplementedError``.\n\n        Examples\n        --------\n        List the identities available to use in Function-backed columns:","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/lancedb/lancedb/blob/c7b051aff7039333a3f61b79217246c27676806a/python/python/lancedb/db.py#L692-L728","documentation":"create_function_async submits a scalar Python UDF to the remote Function catalog and is remote-only; the base class raises NotImplementedError because local connections have no Function catalog. Its blocking counterpart create_function simply calls this method, so both raise the same error on local connections.","triggerScenarios":"Calling db.create_function(definition) or db.create_function_async(definition) on a local connection; any use of the UDF Function catalog without a remote backend.","commonSituations":"Registering UDFs locally expecting catalog persistence (local UDFs are per-table, not cataloged); docs/examples for remote catalogs applied to local DBs.","solutions":["Use a remote lancedb connection with the Function catalog if you need registered UDFs.","For local tables, register UDFs directly on the table (e.g. table.add_udf / pandas UDF workflows) instead of the catalog.","Catch NotImplementedError and fall back to table-level UDF registration.","Verify connection type before calling (remote-only API)."],"exampleFix":"# before\ndb.create_function(udf_definition)\n# after\ntry:\n    db.create_function(udf_definition)\nexcept NotImplementedError:\n    table.add_udf(udf_definition)  # local, per-table UDF registration","handlingStrategy":"try-catch","validationCode":"if not hasattr(db, \"namespace_client\") and type(db).__name__.lower().find(\"remote\") == -1:\n    raise RuntimeError(\"Function catalog requires a remote connection\")","typeGuard":"def function_catalog_supported(db) -> bool:\n    fn = getattr(type(db), \"create_function_async\", None)\n    return fn is not None and not getattr(fn, \"__isabstractmethod\", False)","tryCatchPattern":"try:\n    db.create_function(definition)\nexcept NotImplementedError:\n    table.add_udf(definition)  # local, per-table UDF registration","preventionTips":["Remember the Function catalog is remote-only; local UDFs are per-table","Wrap remote-only catalog APIs behind capability checks","Document UDF persistence differences between local and remote in your codebase"],"tags":["python","lancedb","udf","remote-only","not-implemented"],"backgroundTag":"unsupported-operation","analyzedSha":"c7b051aff7039333a3f61b79217246c27676806a","analyzedAt":"2026-09-08T23:42:37.579Z","contentChangedAt":"2026-09-08T23:42:37.579Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}