Skip to content

Commit

Permalink
Add trino container.
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydtabb committed Jul 6, 2024
1 parent c9a4256 commit a916272
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/malloy-db-trino/src/trino_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class TrinoConnection implements Connection, PersistSQLResults {
// TODO: check user is set.
this.trino = Trino.create({
server: config.server,
catalog: 'malloy_demo', //config.catalog,
catalog: config.catalog,
schema: config.schema,
auth: new BasicAuth(config.user!, config.password),
});
Expand Down
34 changes: 34 additions & 0 deletions test/trino/trino_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /bin/bash
rm -rf .tmp
mkdir .tmp

# generate config file
> ./.tmp/bigquery.properties
cat << EOF > ./.tmp/bigquery.properties
connector.name=bigquery
bigquery.project-id=advance-lacing-417917
bigquery.credentials-key=$BQ_CREDENTIALS_KEY
bigquery.arrow-serialization.enabled=false
EOF

# run docker
docker run -p 8090:8080 -d -v ./.tmp/bigquery.properties:/etc/trino/catalog/bigquery.properties --name trino-malloy trinodb/trino

# wait for server to start
counter=0
while ! docker logs trino-malloy 2>&1 | grep -q "SERVER STARTED"
do
sleep 1
counter=$((counter+1))
# if doesn't start after 2 minutes, output logs and kill process
if [ $counter -eq 120 ]
then
docker logs trino-malloy >& ./.tmp/trino-malloy.logs
docker rm -f trino-malloy
echo "Trino did not start successfully, check .tmp/trino-malloy.logs"
exit 1
break
fi
done

echo "Trino running on port localhost:8090"
7 changes: 7 additions & 0 deletions test/trino/trino_stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

# clear tmp files
rm -rf .tmp

# stop container
docker rm -f trino-malloy

0 comments on commit a916272

Please sign in to comment.