Skip to content

Commit

Permalink
Patch dollar quote for jobs (#102)
Browse files Browse the repository at this point in the history
* dollar quote jobs

* bump ver

* fix test

* change ci path
  • Loading branch information
ChuckHend authored Apr 18, 2024
1 parent b9e8de2 commit 3ac2430
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/extension_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ on:
- main
paths:
- ".github/workflows/extension_upgrade.yml"
- "./extension/**"
- "extension/**"
push:
branches:
- main
paths:
- ".github/workflows/extension_upgrade.yml"
- "./extension/**"
- "extension/**"

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion extension/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vectorize"
version = "0.14.1"
version = "0.14.2"
edition = "2021"
publish = false

Expand Down
2 changes: 1 addition & 1 deletion extension/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "The simplest way to orchestrate vector search on Postgres."
homepage = "https://github.com/tembo-io/pg_vectorize"
documentation = "https://github.com/tembo-io/pg_vectorize"
categories = ["orchestration", "machine_learning"]
version = "0.14.1"
version = "0.14.2"

[build]
postgres_version = "15"
Expand Down
Empty file.
8 changes: 3 additions & 5 deletions extension/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn _handle_table_update(job_name: &str, record_ids: Vec<String>, inputs: Vec<Str

// send the job message to the queue
let query = format!(
"select pgmq.send('{VECTORIZE_QUEUE}', '{}');",
"select pgmq.send('{VECTORIZE_QUEUE}', $${}$$::jsonb);",
serde_json::to_string(&job_message).unwrap()
);
let _ran: Result<_, spi::Error> = Spi::connect(|mut c| {
Expand Down Expand Up @@ -169,10 +169,8 @@ pub fn initalize_table_job(
inputs: b,
};
let query = format!(
"select pgmq.send('{VECTORIZE_QUEUE}', '{}');",
serde_json::to_string(&job_message)
.unwrap()
.replace('\'', "''")
"select pgmq.send('{VECTORIZE_QUEUE}', $${}$$::jsonb);",
serde_json::to_string(&job_message).unwrap()
);
let _ran: Result<_, spi::Error> = Spi::connect(|mut c| {
let _r = c.update(&query, None, None)?;
Expand Down
2 changes: 1 addition & 1 deletion extension/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async fn test_realtime_job() {

let insert_query = format!(
"INSERT INTO \"{test_table_name}\"(product_id, product_name, description)
VALUES ({random_product_id}, 'car tester', 'a product for testing cars');"
VALUES ({random_product_id}, 'car tester', $$a product for testing car's components$$);"
);

// insert a new row
Expand Down

0 comments on commit 3ac2430

Please sign in to comment.