Request a large text file containing JSON objects

I have several Gigabytes text files in the format: {"user_ip": "xxxx", "action_type": "xxx", "action_data": {"some_key": "some_value" ...}, ...}

each record is one line.

First, I would like to easily find the entries for this ip. This part is simple because I can use grep, for example. However, even for this, I would like to find a better solution, because I would like to get an answer as quickly as possible.

The next part is more complicated, because I would like to find entries from the selected ip and the selected type and with the specific value some_key in action_data.

Maybe I would have to convert this file to SQL db (maybe SQLite, because it will be the APP desktop), but I would ask if there are better solutions?

+3
source share
4 answers

You can look at MongoDB , a document-based database. With it, you essentially save JSON objects, which you can then index and easily query in an efficient way. You can find the query in the docs: Querying .

+1
source

Yes, put it in a database, any database. Then the request for it will be simple.

+1
source

, Oracle Berkeley DB 11gR2 ( 1 2010 ) SQL API. , SQL API API sqlite3(). , , SQLite concurrency Berkeley DB, .

,

Dave

+1

SQL, SQLite. , , , , . , , IP-, , , - , .

, , . IP, .., Oracle Berkeley DB. , , Berkeley DB .

, , . , Android, . , SQLite, , , , , .

0

Source: https://habr.com/ru/post/1747517/


All Articles