|
| 1 | +#!/bin/bash |
| 2 | +# |
1 | 3 | # Licensed to the Apache Software Foundation (ASF) under one |
2 | 4 | # or more contributor license agreements. See the NOTICE file |
3 | 5 | # distributed with this work for additional information |
|
15 | 17 | # specific language governing permissions and limitations |
16 | 18 | # under the License. |
17 | 19 |
|
18 | | -#!/bin/bash |
19 | 20 | set -e |
20 | 21 |
|
21 | 22 | HOST_URL="http://localhost:9047" |
@@ -49,16 +50,29 @@ TOKEN=$(curl -s -X POST "$LOGIN_URL" \ |
49 | 50 | -d "{ \"userName\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\" }" \ |
50 | 51 | | grep -oP '(?<="token":")[^"]+') |
51 | 52 |
|
52 | | -SQL_QUERY="Create Table \$scratch.ODBCTest As SELECT CAST(2147483647 AS INTEGER) AS sinteger_max, CAST(9223372036854775807 AS BIGINT) AS sbigint_max, CAST(999999999 AS DECIMAL(38,0)) AS decimal_positive, CAST(3.40282347E38 AS FLOAT) AS float_max, CAST(1.7976931348623157E308 AS DOUBLE) AS double_max, CAST(true AS BOOLEAN) AS bit_true, CAST(DATE '9999-12-31' AS DATE) AS date_max, CAST(TIME '23:59:59' AS TIME) AS time_max, CAST(TIMESTAMP '9999-12-31 23:59:59' AS TIMESTAMP) AS timestamp_max;" |
53 | | -ESCAPED_QUERY=$(printf '%s' "$SQL_QUERY" | sed 's/"/\\"/g') |
54 | | - |
| 53 | +SQL_QUERY=" |
| 54 | +Create Table \$scratch.ODBCTest As |
| 55 | + SELECT CAST(2147483647 AS INTEGER) AS sinteger_max, |
| 56 | + CAST(9223372036854775807 AS BIGINT) AS sbigint_max, |
| 57 | + CAST(999999999 AS DECIMAL(38,0)) AS decimal_positive, |
| 58 | + CAST(3.40282347E38 AS FLOAT) AS float_max, |
| 59 | + CAST(1.7976931348623157E308 AS DOUBLE) AS double_max, |
| 60 | + CAST(true AS BOOLEAN) AS bit_true, |
| 61 | + CAST(DATE '9999-12-31' AS DATE) AS date_max, |
| 62 | + CAST(TIME '23:59:59' AS TIME) AS time_max, |
| 63 | + CAST(TIMESTAMP '9999-12-31 23:59:59' AS TIMESTAMP) AS timestamp_max; |
| 64 | +" |
55 | 65 | echo "Creating \$scratch.ODBCTest table." |
56 | 66 |
|
57 | 67 | # Create a new table by sending a SQL query. |
58 | 68 | curl -i -X POST "$SQL_URL" \ |
59 | 69 | -H "Authorization: _dremio$TOKEN" \ |
60 | 70 | -H "Content-Type: application/json" \ |
61 | | - -d "{\"sql\": \"$ESCAPED_QUERY\"}" |
| 71 | + -d "$(python3 - <<'EOF' |
| 72 | +import json |
| 73 | +print(json.dumps({"sql": """$SQL_QUERY"""})) |
| 74 | +EOF |
| 75 | +)" |
62 | 76 |
|
63 | 77 | echo "" |
64 | 78 | echo "Finished setting up dremio docker instance." |
0 commit comments