SQL Editor
The SQL Editor is where you write SQL against your dataSights database: explore the tables your connectors have synced, run a query, and save the result as a view that Power BI, Excel, Google Sheets and your AI tool can all read. It is the tool behind transforming once: put the logic in a view, and every reporting tool downstream just reads a finished table.
Open it from the menu: Data Engineering > 4. Data > SQL Editor.
It runs against your live database and it is not read only, so access is usually kept to a small number of people. If you only need to look at data, use the Data Viewer instead.
Find your way around
Data Explorer, on the left, lists your tables and views. Objects are grouped by connector, with System Tables, Other and Views at the end. Use Search... to narrow the tree, the refresh icon to pick up objects created since the page loaded, and the arrow at the top right of the panel to collapse it and give the editor more room.
The SQL Editor window in the middle is where you write your query. Select Execute to run it.
Results, underneath, shows the rows that came back.
Video guide, at the top right, plays a short walkthrough of the screen.
Explore a table or view
Select an object in the Data Explorer. dataSights writes a
SELECT TOP 100naming every column into the editor. This replaces whatever was there, so copy your work out first if you still need it.Right-click an object for more:
Select query does the same as selecting it: a
SELECT TOP 100.Show Columns lists the column names and data types, which is handy while you are writing a join.
View definition loads the SQL behind a view. It appears only on objects in the Views group.
Run a query
Write or paste your SQL. Press Ctrl+Space for autocomplete: it knows your table and column names.
Select Execute.
Results appear underneath. Select a column heading to sort, drag a column edge to widen it, and choose 10, 50, 100, 500 or 1000 rows per page at the bottom.
Export to CSV downloads the whole result set, not just the page you are looking at.
A statement that returns no rows, such as CREATE VIEW, reports Commands completed successfully. instead of a grid. If SQL Server rejects the statement, its error text appears under Results, naming the line and the problem.
A query is given about three minutes. Anything still running after that is cancelled, and you get a message saying so rather than a page that sits there. Narrow the query and try again.
Create a new view: a worked example
Say you want one list of unpaid customer invoices across every Xero entity, ready for Power BI.
In the Data Explorer, select Invoices under your Xero connector. A
SELECT TOP 100appears in the editor.Cut it back to the columns you want and join in the entity and customer names. Select Execute and check the rows look right before you go any further.
SELECT xo.Name AS Entity ,c.name AS Customer ,i.invoicenumber AS InvoiceNumber ,i.date AS InvoiceDate ,i.duedate AS DueDate ,i.currencycode AS Currency ,i.total AS Total ,i.amountdue AS AmountDue FROM Invoices i INNER JOIN XeroOrganisation xo ON xo.Id = i.XeroOrganisationId LEFT JOIN XeroContacts c ON c.contactid = i.contact_contactid AND c.XeroOrganisationId = i.XeroOrganisationId WHERE i.invoicetypedescribed = 'AccountsReceivable' AND i.amountdue > 0Once the rows are right, put
CREATE VIEW ... ASin front of theSELECTand give the view a name.CREATE VIEW vw_UnpaidSalesInvoices AS SELECT xo.Name AS Entity ,c.name AS Customer ,i.invoicenumber AS InvoiceNumber ,i.date AS InvoiceDate ,i.duedate AS DueDate ,i.currencycode AS Currency ,i.total AS Total ,i.amountdue AS AmountDue FROM Invoices i INNER JOIN XeroOrganisation xo ON xo.Id = i.XeroOrganisationId LEFT JOIN XeroContacts c ON c.contactid = i.contact_contactid AND c.XeroOrganisationId = i.XeroOrganisationId WHERE i.invoicetypedescribed = 'AccountsReceivable' AND i.amountdue > 0Select Execute. You get Commands completed successfully.
Select the refresh icon on the Data Explorer. Your view is now in the Views group and behaves like any other object: select it for a
SELECT TOP 100, or point the Caching Service, the Snapshot Service, the GSheet Push Service, Power BI or your AI tool at it.
Two habits worth keeping. Name every output column with AS, because a view cannot have an unnamed column. And give your views a consistent prefix such as vw_ so they are easy to pick out of the tree later.
The table and column names above are the ones a Xero connector creates. Your own tables are named after your connectors, so check the Data Explorer and Show Columns rather than copying names from here.
Change an existing view
In the Data Explorer, open the Views group and right-click the view.
Select View definition. The view's SQL loads into the editor.
Change
CREATE VIEWtoALTER VIEWon the first line. SQL Server keeps the statement the view was last defined with and hands it back as it was written, so for most views that isCREATE VIEW. Running it again unchanged fails with "There is already an object named ...".ALTER VIEWupdates the view in place. If the first line already saysALTER VIEW, the view has been edited this way before and there is nothing to change.Make your edit and select Execute. Commands completed successfully. means the view is updated.
To copy a view into a new one instead of changing it, leave
CREATE VIEWalone and change the name on the first line.
Anything already reading the view (a Power BI report, a cached table, a Google Sheet push, an AI tool) picks up the new definition on its next refresh. Adding or renaming columns can break what reads it, so check the downstream report after a structural change.
Related: Data Viewer · Transform once: why SQL views · Caching Service · Snapshot Service · GSheet Push Service · AI Connect · Users, roles & permissions