Connector syntax
Every driverless connector follows the same contract. Learn it once and the other thirteen behave the way you expect.
Reader.Function(
source as binary,
optional options as record
) as table
The source is always a binary
No connector takes a file path, a connection string or a URL. It takes bytes. That is the single design decision the whole thing rests on: acquiring the file and decoding the file are separate problems, and Power Query already solved the first one.
So the same call works wherever the file lives:
// local disk
Sqlite3.Database(File.Contents("C:\data\chinook.db"))
// SharePoint, OneDrive — refreshes in the Service with no gateway
Sqlite3.Database(SharePoint.Files("https://contoso.sharepoint.com/sites/data"){[Name = "chinook.db"]}[Content])
// Azure Blob storage
Sqlite3.Database(AzureStorage.Blobs("https://contoso.blob.core.windows.net/data"){[Name = "chinook.db"]}[Content])
// a public URL
Sqlite3.Database(Web.Contents("https://example.com/chinook.db"))
It also means a whole folder of files is a Table.AddColumn away:
let
Files = Folder.Files("C:\exports"),
Dbfs = Table.SelectRows(Files, each Text.Lower([Extension]) = ".dbf"),
Decoded = Table.AddColumn(Dbfs, "Data", each Dbf.Table([Content]))
in
Decoded
Credentials are whatever the source function already uses. The connectors never prompt for anything of their own.
Two output shapes
Single-table formats return the table directly. A .dbf file is one table,
an .avro file is one stream of records, an .evtx file is one log:
Dbf.Table(File.Contents("C:\data\customers.dbf"))
Container formats return a navigation table. A database, a workbook or a
.mat file holds several things, so the connector returns one row per item with
the decoded value in a Data column. Drill in by name:
let
db = Sqlite3.Database(File.Contents("C:\data\chinook.db")),
tbl = db{[Name = "tracks"]}[Data]
in
tbl
The navigation table carries the ItemKind / ItemName / IsLeaf columns
Power Query looks for, so in the editor you get the ordinary navigator
experience — double-click a row instead of writing the lookup by hand.
Which connectors do what:
| Shape | Connectors |
|---|---|
| Table | Dbf.Table, Avro.Document, Evtx.Document |
| Navigation table | Sqlite3.Database, Gpkg.Database, Mbtiles.Document, AccessReader.Database, Xls.Workbook, Xlsb.Workbook, Spss.Document, Stata.Document, Matlab.Document |
Spss.Document and Stata.Document always return the same three rows — Data,
Variables and ValueLabels — because a survey file's dictionary is worth as
much as its cases.