Skip to content

Commit

Permalink
inherit constraints on examples (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckHend authored Mar 4, 2024
1 parent 0ff0d84 commit 3edbd44
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Running the earlier SHOW command should reveal the appropriate change:
```sql
SHOW vectorize.embedding_service_url;
```

```text
vectorize.embedding_service_url
-------------------------------------
Expand All @@ -175,14 +176,15 @@ Begin by creating a `producs` table with the dataset that comes included with `p

```sql
CREATE TABLE products AS
SELECT * FROM vectorize.example_products;
TABLE vectorize.example_products WITH DATA;
```

You can then confirm everything is correct by running the following:

```sql
SELECT * FROM products limit 2;
```

```text
product_id | product_name | description | last_updated_at
------------+--------------+--------------------------------------------------------+-------------------------------
Expand All @@ -201,6 +203,7 @@ columns => ARRAY['product_name', 'description'],
transformer => 'sentence-transformers/multi-qa-MiniLM-L6-dot-v1'
);
```

```text
table
---------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Setup a products table. Copy from the example data provided by the extension.

```sql
CREATE TABLE products AS
SELECT * FROM vectorize.example_products;
TABLE vectorize.example_products WITH DATA;
```

```sql
Expand Down Expand Up @@ -167,7 +167,7 @@ Create an example table if it does not already exist.

```sql
CREATE TABLE products AS
SELECT * FROM vectorize.example_products;
TABLE vectorize.example_products WITH DATA;
```

Initialize a table for RAG. We'll use an open source Sentence Transformer to generate embeddings.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/openai_embeddings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Create an example table if it does not already exist.

```sql
CREATE TABLE products AS
SELECT * FROM vectorize.example_products;
TABLE vectorize.example_products WITH DATA;
```

Then create the job.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/sentence_transformers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Create an example table if it does not already exist.

```sql
CREATE TABLE products AS
SELECT * FROM vectorize.example_products;
TABLE vectorize.example_products WITH DATA;
```

```sql
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async fn test_static() {
let test_table_name = "products_test_static";
let job_name = "static_test_job";
let query = format!(
"CREATE TABLE IF NOT EXISTS {test_table_name} as SELECT * from vectorize.example_products;"
"CREATE TABLE IF NOT EXISTS {test_table_name} AS TABLE vectorize.example_products WITH DATA;"
);
let _ = sqlx::query(&query)
.execute(&conn)
Expand Down
2 changes: 1 addition & 1 deletion tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub mod common {

pub async fn init_test_table(test_num: i32, conn: &Pool<Postgres>) -> String {
let table = format!("product_{test_num}");
let q = format!("CREATE TABLE {table} as SELECT * from vectorize.example_products;");
let q = format!("CREATE TABLE {table} AS TABLE vectorize.example_products WITH DATA");
let _ = sqlx::query(&q)
.execute(conn)
.await
Expand Down

0 comments on commit 3edbd44

Please sign in to comment.