cherry-pick Load XML Files
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/fb007c00 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/fb007c00 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/fb007c00 Branch: refs/heads/release2.2 Commit: fb007c00469a36b37e58d1821581fdbe38527626 Parents: 08b41ed Author: liu.yu <yu....@esgyn.cn> Authored: Sun Aug 13 16:06:25 2017 +0800 Committer: liu.yu <yu....@esgyn.cn> Committed: Tue Aug 22 11:54:15 2017 +0800 ---------------------------------------------------------------------- docs/odb_user/src/asciidoc/_chapters/load.adoc | 38 +++++++++------------ 1 file changed, 17 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/fb007c00/docs/odb_user/src/asciidoc/_chapters/load.adoc ---------------------------------------------------------------------- diff --git a/docs/odb_user/src/asciidoc/_chapters/load.adoc b/docs/odb_user/src/asciidoc/_chapters/load.adoc index 6a2eb86..91c0125 100644 --- a/docs/odb_user/src/asciidoc/_chapters/load.adoc +++ b/docs/odb_user/src/asciidoc/_chapters/load.adoc @@ -455,7 +455,7 @@ JOB:FIXED:23:10 <- insert into JOB characters starting at position Load as follows: ``` -$ odb64luo âu user âp xx âd dsn \ +$ odb64luo âu user âp xx âd dsn \ -l src=frends1.dat:tgt=TRAFODION.MFTEST.FRIENDS1:map=ff.map:ns=\?:pc=32 ``` @@ -494,16 +494,16 @@ You can use a mapfile like this: ``` ~/Devel/odb $ cat person.map PID:SEQ:100 -FNAME:DSRAND:datasets/first_names.txt -LNAME:DSRAND:datasets/last_names.txt +FNAME:DSRAND:datasets/first_names.txt +LNAME:DSRAND:datasets/last_names.txt COUNTRY:DSRAND:datasets/countries.txt -CITY:DSRAND:datasets/cities.txt +CITY:DSRAND:datasets/cities.txt BDATE:DRAND:1800:2012 SEX:LSTRAND:M,F,U -EMAIL:EMRAND:3:12:5:8:com,edu,org,net -SALARY:NRAND:9:2 -EMPL:DSRAND:datasets/fortune500.txt -NOTES:TXTRAND:20:80:datasets/lorem_ipsum.txt +EMAIL:EMRAND:3:12:5:8:com,edu,org,net +SALARY:NRAND:9:2 +EMPL:DSRAND:datasets/fortune500.txt +NOTES:TXTRAND:20:80:datasets/lorem_ipsum.txt LOADTS:CTSTAMP ``` @@ -599,7 +599,7 @@ Then: * Fifth column (`COMMENT`) is loaded with the fifth column in the input file (`COMMENT:4`) [[load_binary_files]] -== Loading Binary Files +== Load Binary Files Assuming that your back-end database (and your ODBC Driver) supports BLOB data types, or equivalent, you can use odb to directly load binary (or any other) files into a database column using the `[:em=char]` symbol to identify the file to be loaded into that specific database field. @@ -637,7 +637,6 @@ odb considers the string following the âemâ character as the path of the fil NOTE: odb does not load rows where the size of the input file is greater than the target database column. -======= [[load_xml_files]] == Load XML Files Trafodion odb supports loading XML files into tables, the key construct for XML files can be an element or an attribute. @@ -741,7 +740,7 @@ And an input file that contains: The max length of the second field in this file is: ``` -~/Devel/odb $ awk -F\, 'BEGIN\{max=0} \{if(NF==2)\{len=length($i);if(len>max)max=len}} +~/Devel/odb $ awk -F\, 'BEGIN\{max=0} \{if(NF==2)\{len=length($i);if(len>max)max=len}} END\{print max}' tmx.dat 15 ``` @@ -841,7 +840,7 @@ The following table describes each extract operator: [cols="30%,70%",options="header",] |=== -| Extract option | Meaning +| Extract option | Meaning | `src=<CAT.SCH.TAB>\|-file` | Defines the source table(s). You can use: + + - a single table name (for example TRAFODION.MFTEST.LINEITEM) + @@ -1178,7 +1177,7 @@ You can use odb to copy a list of tables from one database to another. *Example* ``` -~/Devel/odb $ cat tlist.txt +~/Devel/odb $ cat tlist.txt # List of tables to extract src=TRAFODION.MAURIZIO.ORDERS @@ -1198,7 +1197,7 @@ Please note the `src=-tlist.txt`. This command copies: [cols="50%,50%",options="header",] |=== -| Source | Target +| Source | Target | `TRAFODION.MAURIZIO.ORDERS` | `tpch.stg_orders` | `TRAFODION.MAURIZIO.CUSTOMER` | `tpch.stg_customer` | `TRAFODION.MAURIZIO.PART` | `tpch.stg_part` @@ -1216,10 +1215,10 @@ Using different _splitby columns_. ``` ~/Devel/odb $ cat tlist2.txt -# List of tables to extract and their âsplitby columnsâ -src=TRAFODION.MAURIZIO.ORDERS:splitby=O_ORDERKEY -src=TRAFODION.MAURIZIO.CUSTOMER:splitby=C_CUSTOMERKEY -src=TRAFODION.MAURIZIO.PART:splitby=P_PARTKEY +# List of tables to extract and their âsplitby columnsâ +src=TRAFODION.MAURIZIO.ORDERS:splitby=O_ORDERKEY +src=TRAFODION.MAURIZIO.CUSTOMER:splitby=C_CUSTOMERKEY +src=TRAFODION.MAURIZIO.PART:splitby=P_PARTKEY src=TRAFODION.MAURIZIO.LINEITEM:splitby=L_PARTKEY ``` @@ -1285,6 +1284,3 @@ relational database. For example, you can copy to from HIVE and other databases from/to Hadoop. odb interacts directly with the HDFS file system using *libhdfs*. + This option is currently available only under Linux. - - -