{"record":{"id":"2a7a360372d8096b","repo":"perspective-dev/perspective","slug":"views-cannot-be-loaded-directly-load-a-table-or-r","errorCode":null,"errorMessage":"Views cannot be loaded directly, load a table or raw data instead","messagePattern":"Views cannot be loaded directly, load a table or raw data instead","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"rust/perspective-python/perspective/widget/viewer/viewer.py","lineNumber":227,"sourceCode":"        if self.table is not None:\n            self.reset()\n\n        if isinstance(data, perspective.perspective.AsyncTable):\n            self._table = data\n            async def load_table():\n                self._client = await self.table.get_client()\n                self.table_name = self.table.get_name()\n                # If the user does not set columns to show, synchronize viewer state\n                # with dataset.\n                if len(self.columns) == 0:\n                    self.columns = await self.table.columns()\n\n            return load_table()\n        elif isinstance(data, perspective.perspective.Table):\n            self._table = data\n            self._client = data.get_client()\n        elif isinstance(data, perspective.perspective.View) or isinstance(data, perspective.perspective.AsyncView):\n            raise TypeError(\n                \"Views cannot be loaded directly, load a table or raw data instead\"\n            )\n        else:\n            self._table = perspective.table(data, name=name, **options)\n            self._client = perspective.GLOBAL_CLIENT\n\n        # If the user does not set columns to show, synchronize viewer state\n        # with dataset.\n        if len(self.columns) == 0:\n            self.columns = self.table.columns()\n\n        self.table_name = self.table.get_name()\n\n    def update(self, data):\n        \"\"\"Update the table under management by the viewer with new data.\n        This function follows the semantics of `Table.update()`, and will be\n        affected by whether an index is set on the underlying table.\n","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-python/perspective/widget/viewer/viewer.py#L209-L245","documentation":"PerspectiveViewer.load() accepts a Table, AsyncTable, raw data, or a schema — but not an already-created View. A View is derived viewer state, not a data source; loading one would create circular/conflicting configuration, so the method guards against it before dispatching to the table-loading path.","triggerScenarios":"Thrown at rust/perspective-python/perspective/widget/viewer/viewer.py:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Load the underlying table: viewer.load(view.table)","Load raw data or a schema instead of a View object","Create a new viewer and copy the View's config (group_by, aggregates, etc.) onto it via restore()"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}