Choose a curation task
The analytical examples in this section use Enterprise SQL. Connect with
the SQL guide. For a random subset through the Python SDK in
LanceDB Embedded or LanceDB Enterprise, see Permutation.
Prepare a labeled document dataset
Suppose you need one labeled record per document for a training experiment. Inspect the source records, choose the latest version of each document, then join its label. Finally, check the class balance of the selected records.Example data
Connect with an Enterprise SQL client. The examples use a small document table and a separate label table. Expand the setup below to create them.Create the example tables
Create the example tables
curation_documents has six records describing four documents.
curation_labels has one label for each of three documents. row_id identifies
a record; doc_id identifies the document it describes.Run each statement separately in a scratch database or namespace. Create these
tables once for the whole section, using fresh names if they already exist.score is a sample quality score, not a search result score. Document 10 has
two versions. Document 30 has two records at the same version. Document 40
has no label. These cases let you check the effect of each operation.row_id tie-breaker makes the choice for document 30 deterministic;
choose a tie-breaker that fits your own data.
The example assumes one label per document. Duplicate keys in the label table
would multiply the result rows. The joining guide
shows how to check that assumption.
Check the selected dataset
Compare the result with the task’s requirements: are the expected documents present, are required fields populated, and is the class distribution suitable? This example has two cats and one dog. That distribution may be appropriate for exploration, but it does not establish a representative evaluation set. Profiling provides the counts to inspect. Statistical Sampling and ranking help you adjust the selection without changing the original records.Save and reuse the result
Choose the output according to how you will use it:- A fixed dataset: save the query result in a new table with
CREATE TABLE AS SELECT. Keep that output unchanged when comparing experiments. - A reusable selection: save the query as a view. A view stores the query definition, so it is not a frozen evaluation set.
- Stored results that you refresh: use a materialized view when its supported query and refresh behavior fit the workflow.