全部產品
Search
文件中心

AnalyticDB:Scriptella

更新時間:Jul 06, 2024

本文列出了Scriptella與AnalyticDB MySQL在連通性、建立表、查詢表資料、寫入資料、建立視圖等方面的相容性。

測試環境

JavaJDBCScriptella
Java版本1.8.0_231JDBC版本5.1.48Scriptella下載地址為Scriptella,版本為1.2。

測試範圍

  • 執行命令
    java -jar scriptella.jar -debug etl.xml
  • ETL指令碼
    <!DOCTYPE etl SYSTEM "http://scriptella.org/dtd/etl.dtd">
    <etl>
        <connection id="adb" driver="mysql" url="jdbc:mysql://127.0.0.1:3303/test4dmp" user="k*****" password="" classpath="/Library/scriptella-1.2/mysql-connector-java-5.1.48.jar;/Library/scriptella-1.2/mysql-connector-java-5.1.48-bin.jar" />
    
        <!-- DROP TABLE -->
        <script connection-id="adb">
            drop table if exists `student_etl`;
        </script>
    
        <!-- CREATE TABLE -->
        <script connection-id="adb">
            Create Table `student_etl` (`id` bigint, `name` varchar, `unit` int ) DISTRIBUTE BY HASH(`id`) INDEX_ALL='Y';
        </script>
    
        <!-- QUERY -->
        <query connection-id="adb">
            SELECT * FROM student
        </query>
    
        <!-- INSERT TABLE -->
        <script connection-id="adb">
            insert into student_etl select * from student;
        </script>
    
        <!-- CREATE VIEW -->
        <script connection-id="adb">
            create view student_view as select * from student;
        </script>
    </etl>
  • 傳回值
    2019-12-4 15:02:31 <資訊> Execution Progress.Initializing properties: 1%
    2019-12-4 15:02:31 <詳細> registerDriver: com.mysql.jdbc.Driver@6f539caf
    2019-12-4 15:02:31 <詳細> Found driver class com.mysql.jdbc.Driver
    2019-12-4 15:02:31 <詳細> DriverManager.getConnection("jdbc:mysql://127.0.0.1:3303/test4dmp")
    2019-12-4 15:02:31 <詳細>     trying com.mysql.jdbc.Driver
    2019-12-4 15:02:32 <詳細> getConnection returning com.mysql.jdbc.Driver
    2019-12-4 15:02:32 <詳細> jdbc:mysql://127.0.0.1:3303/test4dmp: Statement cache is enabled (cache size 64). Statement separator ';'. Autocommit: false.
    2019-12-4 15:02:32 <資訊> Execution Progress.Initialized connection JdbcConnection{com.mysql.jdbc.JDBC4Connection}, Dialect{MySQL 5.1.35-analyticdb}, properties {}: 5%
    2019-12-4 15:02:32 <資訊> Execution Progress./etl/script[2] prepared: 6%
    2019-12-4 15:02:32 <資訊> Execution Progress./etl/script[3] prepared: 7%
    2019-12-4 15:02:32 <資訊> Execution Progress./etl/script[4] prepared: 10%
    2019-12-4 15:02:32 <資訊> Registered JMX mbean: scriptella:type=etl,url="file:/Library/scriptella-1.2/etl.xml"
    2019-12-4 15:02:32 <詳細> Executing script /etl/script[1]
    2019-12-4 15:02:33 <詳細>      Executed statement drop table if exists `student_etl`. Update count: 0
    2019-12-4 15:02:33 <詳細> Script /etl/script[1] completed
    2019-12-4 15:02:33 <資訊> Execution Progress./etl/script[1] executed: 27%
    2019-12-4 15:02:33 <詳細> Executing script /etl/script[2]
    2019-12-4 15:02:34 <詳細>      Executed statement Create Table `student_etl` (`id` bigint, `name` varchar, `unit` int ) DISTRIBUTE BY HASH(`id`) INDEX_ALL='Y'. Update count: 0
    2019-12-4 15:02:34 <詳細> Script /etl/script[2] completed
    2019-12-4 15:02:34 <資訊> Execution Progress./etl/script[2] executed: 44%
    2019-12-4 15:02:34 <詳細> Executing query /etl/query[1]
    2019-12-4 15:02:34 <詳細> Processing row #1 for query /etl/query[1]
    2019-12-4 15:02:34 <詳細> Processing row #2 for query /etl/query[1]
    2019-12-4 15:02:34 <詳細>      Executed statement SELECT * FROM student
    2019-12-4 15:02:34 <詳細> Query /etl/query[1] processed.
    2019-12-4 15:02:34 <資訊> Execution Progress./etl/query[1] executed: 61%
    2019-12-4 15:02:34 <詳細> Executing script /etl/script[3]
    2019-12-4 15:02:34 <詳細>      Executed statement insert into student_etl select * from student. Update count: 2
    2019-12-4 15:02:34 <詳細> Script /etl/script[3] completed
    2019-12-4 15:02:34 <資訊> Execution Progress./etl/script[3] executed: 78%
    2019-12-4 15:02:34 <詳細> Executing script /etl/script[4]
    2019-12-4 15:02:35 <詳細>      Executed statement create view student_view as select * from student. Update count: 0
    2019-12-4 15:02:35 <詳細> Script /etl/script[4] completed
    2019-12-4 15:02:35 <資訊> Execution Progress./etl/script[4] executed: 95%
    2019-12-4 15:02:35 <資訊> Execution Progress.Complete
    2019-12-4 15:02:35 <詳細> Commiting connection JdbcConnection{com.mysql.jdbc.JDBC4Connection}
    2019-12-4 15:02:35 <詳細> Closing JdbcConnection{com.mysql.jdbc.JDBC4Connection}
    2019-12-4 15:02:35 <資訊> Execution statistics:
    Executed 1 query, 4 scripts, 5 statements
    /etl/script[1]: Element successfully executed (1 statement). Working time 897 milliseconds. Avg throughput: 1.11 statements/sec.
    /etl/script[2]: Element successfully executed (1 statement). Working time 821 milliseconds. Avg throughput: 1.22 statements/sec.
    /etl/query[1]: Element successfully executed (1 statement). Working time 36 milliseconds. Avg throughput: 27.27 statements/sec.
    /etl/script[3]: Element successfully executed (1 statement). Working time 702 milliseconds. Avg throughput: 1.42 statements/sec.
    /etl/script[4]: Element successfully executed (1 statement). Working time 303 milliseconds. Avg throughput: 3.3 statements/sec.
    Total working time: 3.17 seconds
    2019-12-4 15:02:35 <資訊> Successfully executed ETL file /Library/scriptella-1.2/etl.xml
    傳回值