Skip to content

Commit f4a3c80

Browse files
reggeenrqu1queee
authored andcommitted
update cos-to-sql example
1 parent ee6b01d commit f4a3c80

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cos-to-sql/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ Install `jq`. On MacOS, you can use following [brew formulae](https://formulae.b
9494
* Create the service credential to access the PostgreSQL instance
9595
```
9696
SM_SECRET_FOR_PG_NAME=pg-access-credentials
97-
ibmcloud secrets-manager secret-create \
97+
ibmcloud secrets-manager config set instance-id $SM_INSTANCE_GUID
98+
ibmcloud secrets-manager config set region $REGION
99+
ibmcloud secrets-manager config set service-url https://$SM_INSTANCE_GUID.$REGION.secrets-manager.appdomain.cloud
100+
SM_SECRET_FOR_PG_ID=$(ibmcloud secrets-manager secret-create \
98101
--secret-type="service_credentials" \
99102
--secret-name="$SM_SECRET_FOR_PG_NAME" \
100-
--secret-source-service="{\"instance\": {\"crn\": \"$DB_INSTANCE_ID\"},\"parameters\": {},\"role\": {\"crn\": \"crn:v1:bluemix:public:iam::::serviceRole:Writer\"}}"
101-
102-
SM_SECRET_FOR_PG_ID=$(ibmcloud sm secret-by-name --name $SM_SECRET_FOR_PG_NAME --secret-type service_credentials --secret-group-name default --instance-id $SM_INSTANCE_GUID --region $REGION --output JSON|jq -r '.id')
103+
--secret-source-service="{\"instance\": {\"crn\": \"$DB_INSTANCE_ID\"},\"parameters\": {},\"role\": {\"crn\": \"crn:v1:bluemix:public:iam::::serviceRole:Writer\"}}" \
104+
--output JSON|jq -r '.id')
103105
```
104106
105107
* Create the Code Engine app:

cos-to-sql/utils/db.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function deleteUsers(client) {
113113
const startTime = Date.now();
114114
console.log(`${fn} >`);
115115
return new Promise(function (resolve, reject) {
116-
const queryText = "DROP TABLE users";
116+
const queryText = "DELETE * FROM users";
117117
client.query(queryText, undefined, function (error, result) {
118118
if (error) {
119119
console.log(`${fn} < failed - error: ${error}; duration ${Date.now() - startTime} ms`);

0 commit comments

Comments
 (0)