We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →How to pipe Phoenix Data to CSV in PowerShell
Use standard PowerShell cmdlets to access Phoenix tables.
The CData Cmdlets Module for Phoenix is a standard PowerShell module offering straightforward integration with Phoenix. Below, you will find examples of using our ApachePhoenix Cmdlets with native PowerShell cmdlets.
Creating a Connection to Your Phoenix Data
Connect to Apache Phoenix via the Phoenix Query Server. Set the Server and Port (if different from the default port) properties to connect to Apache Phoenix. The Server property will typically be the host name or IP address of the server hosting Apache Phoenix.
Authenticating to Apache Phoenix
By default, no authentication will be used (plain). If authentication is configured for your server, set AuthScheme to NEGOTIATE and set the User and Password properties (if necessary) to authenticate through Kerberos.
$conn = Connect-ApachePhoenix -Server "$Server" -Port "$Port"
Selecting Data
Follow the steps below to retrieve data from the MyTable table and pipe the result into to a CSV file:
Select-ApachePhoenix -Connection $conn -Table MyTable | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myMyTableData.csv -NoTypeInformation
You will notice that we piped the results from Select-ApachePhoenix 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.