Pipe HPCC Systems Data to CSV in PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

HPCC Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to HPCC Systems data. The Cmdlets allow users to easily query live data - just like working with SQL server.

Use standard PowerShell cmdlets to access HPCC Systems tables.

The CData Cmdlets Module for HPCC Systems is a standard PowerShell module offering straightforward integration with HPCC Systems. Below, you will find examples of using our HPCC Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your HPCC Systems Data

To connect, set the following connection properties: Set URL to the machine name or IP address of the server and the port the server is running on, for example, https://server:port. The User and Password are required to authenticate to the HPCC Systems cluster specified in the URL. Note that LDAP authentication is not currently supported by our ODBC driver.

Set Version to the WsSQL Web server version. Note that if you have not already done so, you will need to install the WsSQL service on the HPCC Systems server. The WsSQL Web service is used to interact with the underlying HPCC Systems platform.

Set Cluster to the target cluster.

$conn = Connect-HPCC  -URL "$URL" -User "$User" -password "$password" -Version "$Version" -Cluster "$Cluster"

Selecting Data

Follow the steps below to retrieve data from the hpcc::test::orders table and pipe the result into to a CSV file:

Select-HPCC -Connection $conn -Table hpcc::test::orders | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myhpcc::test::ordersData.csv -NoTypeInformation

You will notice that we piped the results from Select-HPCC into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.