<?xml version="1.0" encoding="utf-8"?>

<!-- EngineVersion = Java version -->
<ApiConfig Name="Apache Pinot"
           Slug="apache-pinot-connector"
           Type="JDBC"
           Category="big-data"
           Id="EF8FFA41-0CDE-56E3-A3FB-4A3BE01416FE"
           Version="1"
           EngineVersion="8"
           Desc="Query Apache Pinot OLAP tables with JDBC from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools -- almost no coding required."
           Logo="https://cdn.zappysys.com/api/Images/logos/apache-pinot-connector.png"
           HelpLink="https://docs.pinot.apache.org/users/clients/jdbc">

    <VersionHistory>
      <Change Ver="1" Date="2026-09-14" Type="New">Initial JDBC Bridge catalog version. Hands-free Maven JAR download. Auth Notes and SQL examples for ODBC apps.</Change>
    </VersionHistory>
    <Template>
        <Param Name="DriverDownloadPageLink"
               Value="https://docs.pinot.apache.org/users/clients/jdbc" />
        <Param Name="MvnRepositoryDriverDownloadLink"
               Value="https://mvnrepository.com/artifact/org.apache.pinot/pinot-jdbc-client" />
        <Param Name="DriverDownloadLinks"
               Hidden="True"
               Value="pinot-jdbc-client-1.5.0-shaded.jar=https://repo1.maven.org/maven2/org/apache/pinot/pinot-jdbc-client/1.5.0/pinot-jdbc-client-1.5.0-shaded.jar" />
    </Template>

    <Auths>
        <Auth Name="Controller"
              Label="Controller"
              ConnStr="jdbc:pinot://[$HostName$]:[$Port$]"
              HelpLink="https://docs.pinot.apache.org/users/clients/jdbc">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.apache.pinot.client.PinotDriver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.apache.pinot.client.PinotDriver)." HelpLink="https://docs.pinot.apache.org/users/clients/jdbc" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\pinot-jdbc-client-1.5.0-shaded.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://docs.pinot.apache.org/users/clients/jdbc" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://docs.pinot.apache.org/users/clients/jdbc" />
                <Param Name="Port" Label="TCP port" Required="True" Value="9000" Desc="JDBC port (e.g. 9000)." HelpLink="https://docs.pinot.apache.org/users/clients/jdbc" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://docs.pinot.apache.org/users/clients/jdbc" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://docs.pinot.apache.org/users/clients/jdbc" />
            </Params>
            <Notes>
                <![CDATA[<p>Apache Pinot JDBC from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools.</p>
<ol>
  <li>Use the Pinot controller host and port (default <code>9000</code>).</li><li>If the cluster is authenticated, fill user and password from Pinot controller config.</li><li>Broker discovery is handled by the JDBC client; the DSN host must reach controller and brokers.</li>
  <li>Finish the wizard. Then click <strong>Test Connection</strong> on the DSN Main UI (the wizard does not run Test Connection).</li><li>Done. You can query from C#, Python, PowerShell, and ODBC apps.</li>
</ol>]]>
            </Notes>
        </Auth>
    </Auths>

    <Examples>
        <Example Default="True" Group="ODBC" Slug="list-tables" Label="List tables" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Lists tables available to this connection. Use this in Power BI or a SQL Server Linked Server to confirm the catalog before building reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT tableName FROM default.tables]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-rows" Label="Select rows" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Returns rows from <code>airlineStats</code>. Replace the identifier with your catalog object. Works in Excel, SSRS, and Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM airlineStats]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="filter-rows" Label="Filter with WHERE" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Returns matching rows from <code>airlineStats</code>. Swap the column and literal for your schema.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM airlineStats
WHERE id = 1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="join-tables" Label="Join tables" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Joins two tables on a key. Use in Azure Data Factory or SSIS when you need a combined extract.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT a.id, a.name, b.amount
FROM airlineStats AS a
JOIN my_other_table AS b ON a.id = b.parent_id]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="group-by" Label="Aggregate with GROUP BY" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Counts rows per group. Typical Power BI import pattern before a visual.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM airlineStats
GROUP BY status]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="having" Label="Filter groups with HAVING" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Keeps groups whose count is at least 10.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM airlineStats
GROUP BY status
HAVING COUNT(*) >= 10]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="order-limit" Label="Order and limit" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Returns the first 100 rows ordered by a column. Useful for preview in Excel or Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM airlineStats
ORDER BY id
LIMIT 100]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-all" Label="Count rows" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Returns the number of rows in <code>airlineStats</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT COUNT(*) AS row_count FROM airlineStats]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="case-expr" Label="CASE expression" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Maps a column to labels with <code>CASE</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT id,
       CASE WHEN status = 'A' THEN 'Active' ELSE 'Other' END AS status_label
FROM airlineStats]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-list" Label="Select specific columns" HelpLink="https://docs.pinot.apache.org/users/user-guide-query/querying-pinot">
            <Desc><![CDATA[<p>Returns a column list instead of star. Prefer this in Linked Server views.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT id, name, status
FROM airlineStats]]>
            </Code>
        </Example>
    </Examples>
</ApiConfig>
