Skip to content

Commit

Permalink
chore: add echo messages to psql scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed May 28, 2024
1 parent 7cf8e33 commit b0fcfd3
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions samples/snippets/psql-snippets/add_column.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export PGPORT="${PGPORT:-5432}"
export PGDATABASE="${PGDATABASE:-example-db}"

psql -c "ALTER TABLE albums ADD COLUMN marketing_budget bigint"
echo "Added marketing_budget column"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/create_tables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ CREATE TABLE albums (
-- open-source PostgreSQL.
INTERLEAVE IN PARENT singers ON DELETE CASCADE;
SQL

echo "Created Singers & Albums tables in database: [${PGDATABASE}]"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/ddl_batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ CREATE TABLE concerts (
);
SQL

echo "Added venues and concerts tables"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/partitioned_dml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ psql -c "set spanner.autocommit_dml_mode='partitioned_non_atomic'" \
-c "update albums
set marketing_budget=0
where marketing_budget is null"

echo "Updated albums using Partitioned DML"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ psql << SQL
commit;
SQL

echo "Reduced marketing budget"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/update_data_with_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ psql -c "set spanner.copy_upsert=true" \
1;1;100000
2;2;500000
DATA

echo "Copied albums using upsert"
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ psql << SQL
-- durably stored in the database and visible to other transactions.
commit;
SQL

echo "Transferred marketing budget from Album 2 to Album 1"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/write_data_with_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ psql -c "COPY singers (singer_id, first_name, last_name) FROM STDIN" \
< "${directory}singers_data.txt"
psql -c "COPY albums FROM STDIN" \
< "${directory}albums_data.txt"

echo "Copied singers and albums"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/write_data_with_dml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ psql -c "INSERT INTO singers (singer_id, first_name, last_name) VALUES
(13, 'Russel', 'Morales'),
(14, 'Jacqueline', 'Long'),
(15, 'Dylan', 'Shaw')"

echo "4 records inserted"
2 changes: 2 additions & 0 deletions samples/snippets/psql-snippets/write_data_with_dml_batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ psql -c "PREPARE insert_singer AS
-c "EXECUTE insert_singer (16, 'Sarah', 'Wilson');
EXECUTE insert_singer (17, 'Ethan', 'Miller');
EXECUTE insert_singer (18, 'Maya', 'Patel');"

echo "3 records inserted"

0 comments on commit b0fcfd3

Please sign in to comment.