Skip to main content
This guide will walk you through setting up your environment to run queries against ParadeDB. Choose your preferred tool below:
ParadeDB comes with a helpful procedure that creates a table populated with mock data to help you get started. Run the following command to create this table.
Then, inspect the first 3 rows:
Expected Response
Next, let’s create a BM25 index called search_idx on this table. A BM25 index is a covering index, which means that multiple columns can be included in the same index.
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.
You’re all set! Try running some queries.
To get started, create a TypeScript project with Drizzle, postgres.js, and @paradedb/drizzle-paradedb installed.
Create a db.ts file with your database connection and a schema for ParadeDB’s built-in test table:
db.ts
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.
Create a Drizzle Kit configuration that points at the same database:
drizzle.config.ts
Open a TypeScript REPL:
Import your database connection, schema, and any helpers used by the setup and query snippets. The Node REPL does not support static import statements, so use dynamic imports here:
Create and populate mock_items:
Now, in a separate terminal, push the Drizzle schema to create the BM25 index:
To paste a formatted query snippet, enter editor mode:
Paste the query body without its import lines. The helpers from those imports are already available from the dynamic imports above. Press Ctrl+D to run the pasted query.You’re all set! Try running some queries in the REPL.
To start you’ll need a Django project with Psycopg and django-paradedb installed. Run the following to create one:
In myproject/settings.py, add 'django.contrib.postgres' and 'myapp' to INSTALLED_APPS. Then, configure DATABASES["default"] to point to Postgres:
myproject/settings.py
We can now add a model for ParadeDB’s built-in test table and BM25 index:
models.py
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.
Run the migrations to create the table and index:
Now, open a Python shell with python3 manage.py shell and run the following command to populate mock_items.
You’re all set! Try running some queries in your Python shell.
To get started, install SQLAlchemy, Alembic, Psycopg, and sqlalchemy-paradedb.
Initialize Alembic:
Then update the Alembic configuration to point to your database:
alembic.ini
ParadeDB comes with a built-in test table that we’ll run our queries against. Create a models.py file with a model and search index for that table:
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.
Copy this configuration into your migrations/env.py:
migrations/env.py
Next, add a migration to create the mock_items test table. Create a blank migration in 0001_create_mock_items_table.py by running the following command:
Update the generated migration to create the table:
Then, run it with:
Next, autogenerate a new migration to create the search index.
The generated migration should look like this:
0002_add_mock_items_search_index.py
Then run it with:
Finally, run python and execute the following:
You’re all set! Try running some queries in your shell.
To get started, create a Rails app that uses PostgreSQL.
Add the rails-paradedb gem to your Gemfile:
Gemfile
Then install it:
Update config/database.yml to point to your ParadeDB database:
config/database.yml
ParadeDB comes with a built-in test table that we’ll run our queries against. Generate a migration to create it:
Update the generated migration to create mock_items:
db/migrate/*_create_mock_items_table.rb
Next, create a model for the mock_items table in app/models/mock_item.rb:
app/models/mock_item.rb
Then, create a search index for that table in app/models/mock_item_index.rb:
app/models/mock_item_index.rb
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.
Generate a migration for the search index:
Update the generated migration to create the index:
db/migrate/*_create_mock_items_index.rb
Run the migrations:
You’re all set! Open the Rails console and run some queries.
To get started, create a .NET project with EF Core, Npgsql.EntityFrameworkCore.PostgreSQL, and ParadeDB.EntityFrameworkCore installed.
This console app uses OnConfiguring to keep the example self-contained. In ASP.NET Core or another app with dependency injection, register ParadeDB through UseNpgsql in Program.cs:
Replace Program.cs with a DbContext, model, and query scratchpad for ParadeDB’s built-in test table:
Program.cs
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.
Create the EF Core migration:
Open the generated migration in Migrations/*_CreateMockItems.cs and add this seed step to the end of the Up method:
Then apply the migration:
This creates mock_items, the BM25 index, and loads the mock data. Now, run the query included in Program.cs:
You’re all set! Try running some queries by adding them to Program.cs.