CompanyMay 10, 2019

KillrVideo Python Pt. 5— When Data Access is the Easiest Part of a Microservice

Jeffrey Carpenter
Jeffrey CarpenterSoftware Engineer - Stargate
KillrVideo Python Pt. 5— When Data Access is the Easiest Part of a Microservice
pip install dse-driver
# Wait for Cassandra (DSE) to be up, aka registered in etcd
{ "CONTACT_POINTS": ["10.0.75.1"], "DEFAULT_CONSISTENCY_LEVEL": "LOCAL_QUORUM" }
cluster = Cluster(contact_points=contact_points, execution_profiles={EXEC_PROFILE_DEFAULT: profile})
session = cluster.connect("killrvideo")
# retrieve the credentials for provided email from user_credentials table user_credentials = UserCredentialsModel.get(email=email)
# filter().all() returns a ModelQuerySet, we iterate over the query set to get the Model instances user_results = UserModel.filter(user_id__in=user_ids).all() users = list() for user in user_results: users.append(user) return users
SELECT * FROM killrvideo.users WHERE user_id IN <id1>, <id2>... </id2></id1>
Discover more
PythonDataStax Enterprise
Share

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.