Cqlengine queries: how to return dictionary?

Maria

I'm using cqlengine in Django application, where Cassandra is the secondary database.

In some cases I need to join manually the results of SQL and NoSQL database requests.

For SQL I'm using:

model_name.objects.all().values() 

to return dictionary, rather than model-instance objects.

But I can't find the appropriate methods in cqlengine.

As a beginner in python, I do not know how best to implement this functionality within cqlengine library.

Maybe you have some examples of program code, providing this?

Ryan Kuhl

I like to use a generator for loop like such:

[dict(foo) for foo in Bar.objects.all()]

That will return a dictionary of all the objects and depending on your code base will allow you to do custom serialization and deserialization.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to return random dictionary

How to return dictionary formatting?

How to return a sqlalchemy query as a dictionary?

How to return a dictionary by reference in Swift?

How to clear a dictionary after return?

Swift: How to return a dictionary in swift

how to return a list of dictionary in graphene?

How to return exact matches for ManyToMany queries

how to create a function that conditionally queries a dictionary with list of values in Python?

Formatting a dictionary as string for the queries

How to return the key with the largest value in a dictionary

How to return a dictionary through a `UnsafeMutablePointer<CFTypeRef?>?` parameter?

How to return the value of given key in method - dictionary

How to return the values of dictionary in XML file

How to return nested dictionary from function

How to check if a return object is a dictionary in python

How to append the return of a function to a list and a dictionary in a for loop

How to return tvalues from dictionary C#

How to return dictionary keys as a list in Python?

how to return dictionary value with api.onchange

How to return a dictionary in parallel processing in spark?

How can I return a Dictionary<int, object>?

How to sort KeyValue in dictionary and return a string

How to read a json file and return as dictionary in Python

How to Implement a Callback in JavaScript return Value with a Dictionary

how to match the keys of a dictionary and return their values?

How to return a dictionary or array if dict is mixed?

How to return the key only for a nested dictionary?

how to return a dictionary from a function in cpp