Keyspaces -- The Whole School
What is a Keyspace?
A keyspace is like the entire school -- it contains all the gradebooks (column families) and organizes everything together.
In database terms, a keyspace is similar to a "database" in MySQL or PostgreSQL. It's the top-level container.
from pycoldb import Keyspace, Column
# Create a school
school = Keyspace(name="school")
# Add different gradebooks
school.create_column_family("grades")
school.create_column_family("attendance")
school.create_column_family("contacts")
# What gradebooks do we have?
print(school.column_family_names())
# ['attendance', 'contacts', 'grades']
Why Keyspaces?
Imagine you're running two schools. Each school has its own set of gradebooks, and you don't want them mixed up. Keyspaces keep everything separate and organized.