Repository navigation
Conversation
Contributor
|
E2E Tests 🚀 Why these tags?
More on automatic tags from changed files. Test count: Linux: 408 tests across 3 shards. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16472
Summary
Opens SAS (
.sas7bdat,.xpt), SPSS, Stata, ORC, OpenDocument spreadsheet, and common geospatial files from the Explorer pane straight into the Data Explorer, the same way.csvand.xlsxopen today. No R or Python session is needed.These formats are read by DuckDB extensions (mainly the community
read_statextension) that are downloaded the first time a matching file is opened. A new setting,dataExplorer.fileReaders, maps a file extension to the DuckDB extension that reads it, as[core|community/]extension[:function]. Positron ships defaults for the formats above.Users can add their own readers in the Settings editor, or set a value to an empty string to turn one off.
How it works
.geojson,.kml, etc.) are only offered under "Open With..." so they don't shadow the text editor.INSTALL ... FROM community(orcoreforspatial) into Positron's global storage, not~/.duckdb. If the download takes more than a second, a cancellable progress notification appears. If it fails, the error is logged to a new "DuckDB" output channel and an error notification offers "Show Logs". Failures aren't cached, so reopening the file retries.GEOMETRYcolumns fromspatialare converted to WKT text so the grid can show them..sas7bdatand.xpt.Security, and why there are two DuckDB workers
The existing DuckDB worker runs with
allow_unsigned_extensionson macOS so it can load our vendored, Apple-signed Excel extension. DuckDB only lets you set that at startup, so loading downloaded extensions into that worker would skip DuckDB's signature check. Instead, files matched bydataExplorer.fileReadersare opened in a second worker that keeps the signature check on and setslock_configurationafter startup, so later SQL can't turn the check off or move the extension directory. The existing worker is unchanged.Having two workers is cheap:
DuckDBInstancecode for spawning, crash recovery, and idle shutdown. A crash in one only drops the views backed by that worker; the other keeps running.Admin control and offline use
restrictedand machine-scoped, so an untrusted workspace can't make Positron download extensions."dataExplorer.fileReaders": {}throughPOSITRON_ENFORCED_SETTINGS.Interaction with the Positron SAS extension
posit-dev/positron-sas-extension also opens
.sas7bdatand.xptfiles from the Explorer into the Data Explorer, but through a live SAS session. Its custom editors are registered with"priority": "default", which outranks this PR'sbuiltinregistration. For users who have it installed:.sas7bdator.xptopens the SAS extension's viewer, which fails with "No active SAS session" if no session is running.workbench.editorAssociations.There's no conflict for users without the SAS extension, and no overlap in Import Data (the SAS extension doesn't register a data importer).
The SAS extension still handles some things
read_statprobably doesn't, such as PROC CPORT transport files, multi-member.xptfiles, files from the SAS Content and Clinical Repository views, and SAS-side formats. So the two should coexist rather than one replacing the other. Suggested changes on the SAS extension side:"priority": "option"(or make them the default only while a SAS session is running). A plain double-click would then use Positron's viewer, and "Open With..." would still offer the SAS viewer.Release Notes
New Features
.sas7bdat,.xpt), SPSS, Stata, ORC, OpenDocument spreadsheet, and geospatial files directly in the Data Explorer. The DuckDB extension that reads each format is downloaded on first use and can be configured with thedataExplorer.fileReaderssetting (Feature Request: Data Explorer support for.sas7bdatand.xptfiles. #16472).sas7bdatand.xptfiles (Feature Request: Data Explorer support for.sas7bdatand.xptfiles. #16472)Bug Fixes
Validation Steps
@:data-explorer @:duck-db
New tests:
fileReaders.vitest.ts(setting parsing), resolver tests inpositronDataExplorerEditorResolution.vitest.ts, importer registry tests, haven/pyreadstat importer unit tests, and positron-duckdb extension host tests that open small.sas7bdatand.xptfiles through the signed worker (these need network access)..sas7bdator.xptfile in the Explorer pane. The first time, a "Downloading..." notification may appear briefly, then the data opens in the Data Explorer."dataExplorer.fileReaders": {}in settings..sas7bdatand.xptshould no longer open in the Data Explorer (no reload needed)..csvshould still work."foo": "not_a_real_ext", and open a.foofile. You should see an error notification with "Show Logs" rather than a hang..dtafile for the first time. You should get the same error notification.