liveBook · Manning

Schema

As explained in Data Pipelines with Apache Airflow, Second Edition

A database schema is the structural definition of a database's tables, columns, relationships, and other database objects.

A schema defines the structure of stored data. In a Weaviate collection, properties specify field names, data types, and which values participate in vectorization. section 14.6.2

A recipe collection can define these properties:

  • recipe_uuid: a UUID identifying the recipe, excluded from vectorization. section 14.6.2
  • recipe_name: a text field containing the recipe name. section 14.6.2
  • chunk_uuid: a UUID identifying the content chunk, also excluded from vectorization. section 14.6.2
  • chunk: a text field containing the content section to vectorize. section 14.6.2

Schema creation is commonly made repeatable. Check whether the collection already exists, create it only when absent, and delete and recreate it when its definition must change. A dedicated creation task makes this state visible in Airflow. section 14.6.3

Schema migration in Airflow

Airflow's metastore schema can be initialized or upgraded with `airflow db migrate`. The command creates the schema when necessary or applies migration steps for the current database version. Related commands check reachability, reset the database, clean old records, downgrade to a specified revision, or open a database shell. section 15.3

Listing 14.9 Defining the properties of the collection
from weaviate.classes.config Property
from weaviate.classes.config import DataType

...

with get_weaviate_client() as client:

   collection = client.collections.create(
      name = ...,
   vectorizer_config = [...]
   properties=[
      Property(
          name="recipe_uuid",
          data_type= DataType.UUID,
          skip_vectorization=True #1
       ),
      Property(name="recipe_name", data_type= DataType.TEXT),
      Property(
            name="chunk_uuid",
            data_type= DataType.UUID,
            skip_vectorization=True #1
         ),
      Property(name="chunk", data_type=DataType.TEXT),
   ]
   )

Inspect the Python property definitions for UUID and text fields, including the settings that skip vectorization for identifiers. section 14.6.2

How Data Pipelines with Apache Airflow, Second Edition covers it

How deep it goes
Explains properties, data types, vectorization, existence checks, and migrations, but does not detail relational schema internals.
Examples
Uses recipe UUID, recipe name, chunk UUID, and chunk fields alongside Airflow metastore migration commands.
What it assumes
Assumes basic familiarity with collections or databases and teaches field definitions, data types, and schema-management commands.
What you can do after
Build it from scratch by defining Weaviate properties and initialize or upgrade an Airflow metastore with migration commands.
How it connects
Connects schemas with collections, tables, properties, data types, vectorization, metastore databases, and database migrations.

Also explained in

Compare how 44 books explain schema →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Pipelines with Apache Airflow, Second Edition. The section links point to the parts of the book it draws on.