Opened 6 years ago

Closed 6 years ago

#1698 closed defect (fixed)

RasdaPy_Support query with insert into values from file and mdddomain, mddtype

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 9.5
Component: rasdapy Version: development
Keywords: Cc: Dimitar Misev
Complexity: Medium

Description (last modified by Bang Pham Huu)

RasdaPy needs to support this type of query:

e.g: input file is encoded PNG
$RASQL -q "insert into $TEST_SUBSETTING_1D values decode(\$1)" 
-f "$TESTDATA_PATH/mr.png"
  > /dev/null	

then MDDdomain is: "[0:filesize-1]" and MDDtype is: GreyString by default when these parameters (--mdddomain, --mddtype not specified).

if the input file is raw binary without encoded values, then it needs the —mddomain, —mddtype
e.g:

$RASQL -q "insert into $TEST_SUBSETTING_1D values \$1"
 -f "$TESTDATA_PATH/101.bin" --mdddomain "[0:100]" --mddtype GreyString > /dev/null

which in Python code, it creates a POST request like this to send to rasserver as in rasj via protobuf to import data from file into collection, e.g:

Command=11&ClientID=864741134&QueryString=insert into test_rasj values #MDD1#&Endianess=0&NumberOfQueryParameters=1&BinDataSize=67&BinData=\000\000\000\001GreyImage\000\000\000\000\000\001[0:3,0:3]\000[0:10,0:10]\000||0.0\000\000\000\000\020\000\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017"
This key value is encoded in iso-8859-1 with the needed data:

BinData=4bytes_int(1) + MDD_Type + "\0" + "\0" + 4bytes_int(length of base type (e.g: char) + MDD_Domain + "\0" + Tile_Domain + "\0" + "||0.0" + "\0" + 4bytes_int(length_of_binary_content_from_file).

Change History (2)

comment:1 by Bang Pham Huu, 6 years ago

Description: modified (diff)

comment:2 by Bang Pham Huu, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.