Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Weaviate schema #49

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Create Weaviate schema #49

merged 3 commits into from
Nov 29, 2023

Conversation

arihanv
Copy link
Contributor

@arihanv arihanv commented Nov 29, 2023

Summary: This is a cleaner way of creating a Weaviate schema (class) without needing to upsert documents. Additionally, this also helps anyone to inspect the contents of the schema to better understand it!

arihanv and others added 2 commits November 28, 2023 23:51
Update staging branch with latest commits to Main
Copy link

vercel bot commented Nov 29, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
maige ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 29, 2023 3:35pm

@maige-app maige-app bot added the enhancement New feature or request label Nov 29, 2023
@arihanv arihanv requested a review from tedspare November 29, 2023 06:03
@arihanv arihanv added the database All persistence; PlanetScale; MySQL; reads and writes; duplication; sharding label Nov 29, 2023
"indexSearchable": true,
"name": "userId",
"tokenization": "word"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the schema available like this is much nicer

indexFilterable: true,
indexSearchable: true,
name: 'userId',
tokenization: 'word'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the schema available like this is much nicer

@@ -0,0 +1,113 @@
export const schema = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to a static import for the benefits of TS (eg. can access typeof schema.properties[0].name)


try {
await client.schema.classCreator().withClass(schema).do()
console.log('Schema created!')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, super fast. And clean code!

Copy link
Collaborator

@tedspare tedspare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tedspare tedspare merged commit 48df5f7 into main Nov 29, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database All persistence; PlanetScale; MySQL; reads and writes; duplication; sharding enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants