Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Best way to integrate database for cassiopeia objects #5

Closed
Lyie123 opened this issue Nov 17, 2020 · 4 comments
Closed

Best way to integrate database for cassiopeia objects #5

Lyie123 opened this issue Nov 17, 2020 · 4 comments

Comments

@Lyie123
Copy link

Lyie123 commented Nov 17, 2020

Hi!
Sorry if my question is stupid.
I have tried to figure out how to save the cassiopeia objects to a local database.
I have found cassiopeia-sqlstore and integrated it in the pipeline.
But I think its outdated.
What is the easiest way to query and save cassiopeia objects from a database?
Is there a easy way? Or does I have to write my own Pipeline Object?

Greetings Rene

@iann838
Copy link
Owner

iann838 commented Nov 18, 2020

Hi @Lyie123, cassiopeia objects or actual riot api structures are very complex to be saved in an sql database like a actual table, BUT you have a jsonfield that is now live on django 3.1, and you can actually query into those json fields like if it was nosql, i think that is the easiest way. A model with a similar structure as below:

class Match(models.Model)
    match_id = models.IntegerField()
    region = models.CharField(max_length=20)
    data = models.JSONField()

@Lyie123
Copy link
Author

Lyie123 commented Nov 18, 2020

Hi @paaksing , thanks for your reply. I will try it out!
Are you storing cassiopeia objects into a database? If yes, have you integrated your database as datasink within the cassiopeia pipeline?

Thank you so much!

@iann838
Copy link
Owner

iann838 commented Nov 19, 2020

I personally don't use cassiopeia for my riot projects, I use my other framework built from ground up pyot.

To your question about integrating the database as datasink in cass, is no, BUT I have integrated the Django Cache into cassiopeia datasink, you can do it the same way I did here, if you want and actually did it, it would be nice to have a PR for that!

The code that I am building the cache is in
https://github.com/paaksing/django-cassiopeia/tree/master/backends

The store then needs to be injected on the app init.
https://github.com/paaksing/django-cassiopeia/blob/master/django_cassiopeia/__init__.py

If you want to continue this conversation on discord, here is my id Morimorph#6234

@Lyie123

@iann838
Copy link
Owner

iann838 commented Dec 1, 2020

This issue is inactive for 12 days, so I will be closing it, if you still have question, you can reopen it or make a new one.

@iann838 iann838 closed this as completed Dec 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants