ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Ask AI
ScyllaDB Docs ScyllaDB video streaming sample app Data model

Data modelΒΆ

For a detailed guide on how this schema was created read this blog post.

CREATE KEYSPACE IF NOT EXISTS streaming WITH replication = 
{ 'class': 'NetworkTopologyStrategy', 'replication_factor': '3' } and tablets = {'enabled': 'false'};

CREATE TABLE streaming.video (
    id text,
    content_type text,
    title text,
    url text,
    thumbnail text,
    created_at timestamp,
    duration int,
    PRIMARY KEY (id)
);

CREATE TABLE streaming.watch_history (
	user_id text,
	video_id text,
	progress int,
	watched_at timestamp,
	PRIMARY KEY (user_id, video_id)
);

CREATE MATERIALIZED VIEW streaming.recent_videos_view AS
    SELECT * FROM streaming.video
    WHERE created_at IS NOT NULL
    PRIMARY KEY (created_at, id);

USE streaming;

Was this page helpful?

PREVIOUS
Get started
  • Create an issue
  • Edit this page
ScyllaDB video streaming sample app
  • Getting started
  • Data model
  • Designing the data model - blogpost
  • GitHub repository
Docs Tutorials University Contact Us About Us
© 2025, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 02 Dec 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.9
Ask AI