Skip to content

Commit

Permalink
Remove <skipTests> in pom. Remove other databases' drivers. (#9)
Browse files Browse the repository at this point in the history
* v0.0.5: Change XML namespace alias from 'db' to 'teradata' (#6)

* v0.0.3: Added ConnectionParameters unit tests

* v0.0.4: Modified Integration Tests for Teradata Database

* Fix conflict

* v0.0.5: Change XML alias from db to teradata

* Fix conflict

* Add a README.md file (#7)

* Add a README.md file

* Update README.md

* Remove other database drivers from repository (#8)

* Add a README.md file

* Update README.md

* Remove others drivers
  • Loading branch information
tannguyen16 authored Sep 26, 2022
1 parent 81b24b3 commit 7accaaf
Show file tree
Hide file tree
Showing 224 changed files with 1,336 additions and 64,543 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Teradata Connector- Mule 4

Anypoint Connector for Teradata (Teradata Connector) establishes communication between your Mule app and a Teradata Vantage database, enabling you to connect with your Teradata Vantage instance to load data and run SQL queries in Teradata Vantage tables.

# Before You Begin

To use this connector, you must be familiar with:

- Teradata Vantage SQL

- Anypoint Connectors

- Mule runtime engine (Mule)

- Elements and global elements in a Mule flow

- Anypoint Studio (Studio)

Before creating an app, you must have:

- Credentials to access the Teradata Vantage target resource

- Anypoint Studio version 7.5 or later


# Common Use Cases for the Connector

Teradata Connector enables you to:

- Perform predefined queries, dynamically constructed queries, and template queries that are self-sufficient and customizable.

- Use a source listener operation to read from a database in the data source section of a flow.

- Execute other operations to read and write to a database anywhere in the process section.

- Run a single bulk update to perform multiple SQL requests.

- Make Data Definition Language (DDL) requests.

- Execute stored procedures and SQL scripts.

# Next Step

After you complete the prerequisites, you are ready to create an app and configure the connector using Anypoint Studio.
604 changes: 1 addition & 603 deletions pom.xml

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions src/it/tita/src/test/resources/insert-oracle-sys-xmltype-app.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:teradata="http://www.mulesoft.org/schema/mule/teradata"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway"
xmlns="http://www.mulesoft.org/schema/mule/core"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/teradata http://www.mulesoft.org/schema/mule/teradata/current/mule-teradata.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/api-gateway http://www.mulesoft.org/schema/mule/api-gateway/current/mule-api-gateway.xsd">

Expand All @@ -17,37 +17,37 @@
<http:listener-connection host="localhost" port="${port}" protocol="HTTP"/>
</http:listener-config>

<db:config name="Database_Config">
<db:oracle-connection host="localhost" port="${db.port}" user="system" password="oracle" serviceName="XEPDB1"/>
</db:config>
<teradata:config name="Database_Config">
<teradata:oracle-connection host="localhost" port="${db.port}" user="system" password="oracle" serviceName="XEPDB1"/>
</teradata:config>

<flow name="oracleXmlTypeInsertTest">
<http:listener path="/test-insert" config-ref="listenerConfig"/>

<try>
<db:execute-script config-ref="Database_Config">
<db:sql><![CDATA[DROP TABLE XMLTest]]></db:sql>
</db:execute-script>
<teradata:execute-script config-ref="Database_Config">
<teradata:sql><![CDATA[DROP TABLE XMLTest]]></teradata:sql>
</teradata:execute-script>
<error-handler>
<on-error-continue enableNotifications="true" logException="false">
</on-error-continue>
</error-handler>
</try>
<db:execute-ddl config-ref="Database_Config">
<db:sql><![CDATA[CREATE TABLE XMLTEST (ID NUMBER, PUBDATA XMLTYPE)]]></db:sql>
</db:execute-ddl>
<teradata:execute-ddl config-ref="Database_Config">
<teradata:sql><![CDATA[CREATE TABLE XMLTEST (ID NUMBER, PUBDATA XMLTYPE)]]></teradata:sql>
</teradata:execute-ddl>

<set-variable value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;note&gt;&#10;&lt;to&gt;Bob&lt;/to&gt;&#10;&lt;from&gt;Alice&lt;/from&gt; &#10;&lt;heading&gt;Reminder&lt;/heading&gt;&#10;&lt;body&gt;Don't forget me this weekend!&lt;/body&gt;&#10;&lt;/note&gt;" variableName="xmlVar" mimeType="text/plain"/>
<db:insert config-ref="Database_Config">
<db:sql>
<teradata:insert config-ref="Database_Config">
<teradata:sql>
INSERT INTO XMLTEST (ID, PUBDATA) VALUES (1, :description)
</db:sql>
<db:input-parameters>
</teradata:sql>
<teradata:input-parameters>
#[
{'description' : vars.xmlVar}
]
</db:input-parameters>
</db:insert>
</teradata:input-parameters>
</teradata:insert>
</flow>

</mule>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:teradata="http://www.mulesoft.org/schema/mule/teradata"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway"
xmlns="http://www.mulesoft.org/schema/mule/core"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/teradata http://www.mulesoft.org/schema/mule/teradata/current/mule-teradata.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/api-gateway http://www.mulesoft.org/schema/mule/api-gateway/current/mule-api-gateway.xsd">

Expand All @@ -17,21 +17,21 @@
<http:listener-connection host="localhost" port="${port}" protocol="HTTP"/>
</http:listener-config>

<db:config name="Database_Config">
<db:my-sql-connection host="localhost" port="${db.port}" user="root" password="password" database="xe"/>
</db:config>
<teradata:config name="Database_Config">
<teradata:my-sql-connection host="localhost" port="${db.port}" user="root" password="password" database="xe"/>
</teradata:config>

<flow name="mysqlTimeoutTest">
<http:listener path="/test-sp-timeout" config-ref="listenerConfig"/>

<try>
<db:execute-script config-ref="Database_Config">
<db:sql><![CDATA[DROP TABLE TEST_MESSAGE]]></db:sql>
</db:execute-script>
<teradata:execute-script config-ref="Database_Config">
<teradata:sql><![CDATA[DROP TABLE TEST_MESSAGE]]></teradata:sql>
</teradata:execute-script>

<db:execute-script config-ref="Database_Config">
<db:sql><![CDATA[DROP PROCEDURE IF EXISTS GET_DELAYED_MESSAGE_BY_ID;]]></db:sql>
</db:execute-script>
<teradata:execute-script config-ref="Database_Config">
<teradata:sql><![CDATA[DROP PROCEDURE IF EXISTS GET_DELAYED_MESSAGE_BY_ID;]]></teradata:sql>
</teradata:execute-script>

<error-handler>
<on-error-continue enableNotifications="true" logException="false">
Expand All @@ -40,22 +40,22 @@
</try>

<try>
<db:execute-ddl config-ref="Database_Config">
<db:sql><![CDATA[CREATE TABLE TEST_MESSAGE(MSG_ID int NOT NULL AUTO_INCREMENT,
<teradata:execute-ddl config-ref="Database_Config">
<teradata:sql><![CDATA[CREATE TABLE TEST_MESSAGE(MSG_ID int NOT NULL AUTO_INCREMENT,
STATE varchar(255),
MSG int,
PRIMARY KEY (MSG_ID))]]>
</db:sql>
</db:execute-ddl>
</teradata:sql>
</teradata:execute-ddl>

<db:insert config-ref="Database_Config">
<db:sql ><![CDATA[INSERT INTO TEST_MESSAGE (STATE, MSG) values(:state, :msg)]]></db:sql>
<db:input-parameters ><![CDATA[#[{
<teradata:insert config-ref="Database_Config">
<teradata:sql ><![CDATA[INSERT INTO TEST_MESSAGE (STATE, MSG) values(:state, :msg)]]></teradata:sql>
<teradata:input-parameters ><![CDATA[#[{
"state": "SENT",
"msg": 8
}]]]>
</db:input-parameters>
</db:insert>
</teradata:input-parameters>
</teradata:insert>

<error-handler>
<on-error-continue enableNotifications="true" logException="true">
Expand All @@ -65,17 +65,17 @@
</try>

<try>
<db:execute-ddl config-ref="Database_Config">
<db:sql><![CDATA[CREATE PROCEDURE GET_DELAYED_MESSAGE_BY_ID(IN pMsgId int, OUT pState varchar(255))
<teradata:execute-ddl config-ref="Database_Config">
<teradata:sql><![CDATA[CREATE PROCEDURE GET_DELAYED_MESSAGE_BY_ID(IN pMsgId int, OUT pState varchar(255))
BEGIN
SELECT SLEEP(2.0);
SELECT STATE into pState FROM
TEST_MESSAGE MH
WHERE
MH.MSG_ID = pMsgId;
END;]]>
</db:sql>
</db:execute-ddl>
</teradata:sql>
</teradata:execute-ddl>

<error-handler>
<on-error-continue enableNotifications="true" logException="true">
Expand All @@ -85,13 +85,13 @@
</try>

<try>
<db:stored-procedure config-ref="Database_Config" queryTimeout="500" queryTimeoutUnit="MILLISECONDS">
<db:sql><![CDATA[{ call GET_DELAYED_MESSAGE_BY_ID(:msgId, :out) }]]></db:sql>
<db:input-parameters><![CDATA[#[msgId : 1]]]></db:input-parameters>
<db:output-parameters>
<db:output-parameter key="out" type="NVARCHAR" />
</db:output-parameters>
</db:stored-procedure>
<teradata:stored-procedure config-ref="Database_Config" queryTimeout="500" queryTimeoutUnit="MILLISECONDS">
<teradata:sql><![CDATA[{ call GET_DELAYED_MESSAGE_BY_ID(:msgId, :out) }]]></teradata:sql>
<teradata:input-parameters><![CDATA[#[msgId : 1]]]></teradata:input-parameters>
<teradata:output-parameters>
<teradata:output-parameter key="out" type="NVARCHAR" />
</teradata:output-parameters>
</teradata:stored-procedure>

<set-payload value="#[%dw 2.0 output application/json --- payload.out]"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:teradata="http://www.mulesoft.org/schema/mule/teradata"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway"
xmlns="http://www.mulesoft.org/schema/mule/core"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/teradata http://www.mulesoft.org/schema/mule/teradata/current/mule-teradata.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/api-gateway http://www.mulesoft.org/schema/mule/api-gateway/current/mule-api-gateway.xsd">

Expand All @@ -17,19 +17,19 @@
<http:listener-connection host="localhost" port="${port}" protocol="HTTP"/>
</http:listener-config>

<db:config name="Database_Config">
<db:oracle-connection host="localhost" port="${db.port}" user="system" password="oracle" serviceName="XEPDB1">
<db:pooling-profile maxPoolSize="3" maxWait="1" />
</db:oracle-connection>
</db:config>
<teradata:config name="Database_Config">
<teradata:oracle-connection host="localhost" port="${db.port}" user="system" password="oracle" serviceName="XEPDB1">
<teradata:pooling-profile maxPoolSize="3" maxWait="1" />
</teradata:oracle-connection>
</teradata:config>

<flow name="oracleLobForeachTest">
<http:listener path="/test-lob-foreach" config-ref="listenerConfig"/>

<try>
<db:execute-script config-ref="Database_Config">
<db:sql><![CDATA[DROP TABLE TEST_MESSAGE]]></db:sql>
</db:execute-script>
<teradata:execute-script config-ref="Database_Config">
<teradata:sql><![CDATA[DROP TABLE TEST_MESSAGE]]></teradata:sql>
</teradata:execute-script>

<error-handler>
<on-error-continue enableNotifications="true" logException="false">
Expand All @@ -38,15 +38,15 @@
</try>

<try>
<db:execute-ddl config-ref="Database_Config">
<db:sql><![CDATA[CREATE TABLE TEST_MESSAGE(MSG_ID NUMBER(19) GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 NOCACHE ) NOT NULL, STATE varchar2(255), MSG CLOB)]]></db:sql>
</db:execute-ddl>
<teradata:execute-ddl config-ref="Database_Config">
<teradata:sql><![CDATA[CREATE TABLE TEST_MESSAGE(MSG_ID NUMBER(19) GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 NOCACHE ) NOT NULL, STATE varchar2(255), MSG CLOB)]]></teradata:sql>
</teradata:execute-ddl>

<set-payload value='#[[&#10; {&#10; "state": "FAILED",&#10; "msg": "Hola"&#10;},&#10;{&#10; "state": "UNDELIVERED",&#10; "msg": "Hello"&#10;},&#10;{&#10; "state": "UNDELIVERED",&#10; "msg": "Hello"&#10;},&#10;{&#10; "state": "SENT",&#10; "msg": "Bye"&#10;}&#10;]]' />

<db:bulk-insert config-ref="Database_Config">
<db:sql ><![CDATA[INSERT INTO TEST_MESSAGE (STATE, MSG) values(:state, :msg)]]></db:sql>
</db:bulk-insert>
<teradata:bulk-insert config-ref="Database_Config">
<teradata:sql ><![CDATA[INSERT INTO TEST_MESSAGE (STATE, MSG) values(:state, :msg)]]></teradata:sql>
</teradata:bulk-insert>

<error-handler>
<on-error-continue enableNotifications="true" logException="true">
Expand All @@ -56,17 +56,17 @@
</try>

<try>
<db:select config-ref="Database_Config">
<db:sql ><![CDATA[select MSG_ID from TEST_MESSAGE]]></db:sql>
</db:select>
<teradata:select config-ref="Database_Config">
<teradata:sql ><![CDATA[select MSG_ID from TEST_MESSAGE]]></teradata:sql>
</teradata:select>
<foreach collection="payload.MSG_ID">
<db:select config-ref="Database_Config">
<db:sql ><![CDATA[select MSG_ID, STATE, MSG
<teradata:select config-ref="Database_Config">
<teradata:sql ><![CDATA[select MSG_ID, STATE, MSG
from TEST_MESSAGE
where MSG_ID=:msg_id]]>
</db:sql>
<db:input-parameters ><![CDATA[#[{'msg_id':payload}]]]></db:input-parameters>
</db:select>
</teradata:sql>
<teradata:input-parameters ><![CDATA[#[{'msg_id':payload}]]]></teradata:input-parameters>
</teradata:select>
<set-variable value='#[%dw 2.0
output application/json
---
Expand Down
Loading

0 comments on commit 7accaaf

Please sign in to comment.