Automate Presto Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Presto ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Presto.

Are you looking for a quick and easy way to access Presto data from PowerShell? We show how to use the Cmdlets for Presto and the CData ADO.NET Provider for Presto to connect to Presto data and synchronize, automate, download, and more.

The CData Cmdlets for Presto are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Presto.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the Presto API, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Presto data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Presto. To access Presto data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Presto.

After obtaining the needed connection properties, accessing Presto data in PowerShell consists of three basic steps.

Set the Server and Port connection properties to connect, in addition to any authentication properties that may be required.

To enable TLS/SSL, set UseSSL to true.

Authenticating with LDAP

In order to authenticate with LDAP, set the following connection properties:

  • AuthScheme: Set this to LDAP.
  • User: The username being authenticated with in LDAP.
  • Password: The password associated with the User you are authenticating against LDAP with.

Authenticating with Kerberos

In order to authenticate with KERBEROS, set the following connection properties:

  • AuthScheme: Set this to KERBEROS.
  • KerberosKDC: The Kerberos Key Distribution Center (KDC) service used to authenticate the user.
  • KerberosRealm: The Kerberos Realm used to authenticate the user with.
  • KerberosSPN: The Service Principal Name for the Kerberos Domain Controller.
  • KerberosKeytabFile: The Keytab file containing your pairs of Kerberos principals and encrypted keys.
  • User: The user who is authenticating to Kerberos.
  • Password: The password used to authenticate to Kerberos.


  1. Install the module:

    Install-Module PrestoCmdlets
  2. Connect:

    $presto = Connect-Presto -Server "$Server" -Port "$Port"
  3. Search for and retrieve data:

    $id = "123456789" $customer = Select-Presto -Connection $presto -Table "Customer" -Where "Id = `'$Id`'" $customer

    You can also use the Invoke-Presto cmdlet to execute SQL commands:

    $customer = Invoke-Presto -Connection $presto -Query 'SELECT * FROM Customer WHERE Id = @Id' -Params @{'@Id'='123456789'}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Presto\lib\System.Data.CData.Presto.dll")
  2. Connect to Presto:

    $conn= New-Object System.Data.CData.Presto.PrestoConnection("Server=;Port=8080;") $conn.Open()
  3. Instantiate the PrestoDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT FirstName, LastName from Customer" $da= New-Object System.Data.CData.Presto.PrestoDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.firstname $_.lastname }

Update Presto Data


Update-Presto -Connection $Presto -Columns @('FirstName','LastName') -Values @('MyFirstName', 'MyLastName') -Table Customer -Id "MyId"


$cmd = New-Object System.Data.CData.Presto.PrestoCommand("UPDATE Customer SET Id='123456789' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.Presto.PrestoParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Presto Data


Add-Presto -Connection $Presto -Table Customer -Columns @("FirstName", "LastName") -Values @("MyFirstName", "MyLastName")


$cmd = New-Object System.Data.CData.Presto.PrestoCommand("INSERT INTO Customer (Id) VALUES (@myId)", $conn) $cmd.Parameters.Add(new System.Data.CData.Presto.PrestoParameter("@myId","123456789")) $cmd.ExecuteNonQuery()

Delete Presto Data


Remove-Presto -Connection $Presto -Table "Customer" -Id "MyId"


$cmd = New-Object System.Data.CData.Presto.PrestoCommand("DELETE FROM Customer WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.Presto.PrestoParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()