Say I have a large txt or CSV file with data I want to search. And say I have several files.

What is the best way to index and make this data searchable? I’ve been using grep, but it is not ideal.

Is there any self hostable docker container for indexing and searching this? Or maybe should I use SQL?

13 points
*

You can import CSV files directly into an SQLite database. Then you are free to do whatever sql searches or manipulations you want. Python and golang both have great SQLite libraries from personal experience, but I’d be surprised if there is any language that doesn’t have a decent one.

If you are running Linux most distros have an SQLite gui browser in the repos that is pretty powerful.

permalink
report
reply
1 point

I’d be surprised if there is any language that doesn’t have a decent one.

Yeah, SQLite provides a library implemented in C. Because C doesn’t require a runtime, it’s possible for other languages to call into this C library. All you need is a relatively thin wrapper library, which provides an API that feels good to use in the respective language.

permalink
report
parent
reply
5 points

Import it into access(Satan whispers quietly into you ear)

permalink
report
reply
5 points
*

Excel / OnlyOffice?

I love self-hosted tools, but you can do a lot on a spreadsheet.

Btw, if the files are not too large, you can query them using SQL without even hosting a database just by using Pandas. This avoids the problem of updating entries and handling migrations in case the CSVs change over time.

permalink
report
reply
2 points

Files won’t change and are hundreds of GBs

permalink
report
parent
reply
1 point

Are they roughly 55GB compressed?

permalink
report
parent
reply
1 point

Spill the beans!

permalink
report
parent
reply
1 point

ok, database it is then

permalink
report
parent
reply
1 point
*

Could use Polars, afaik it supports streaming from CSVs too, and frankly the syntax is so much nicer than pandas coming from spark land.

Do you need to persist? What are you doing with them? A really common pattern for analytics is landing those in something like Parquet, Delta, less frequently seen Avro or ORC and then working right off that. If they don’t change, it’s an option. 100 gigs of CSVs will take some time to write to a database depending on resources, tools, db flavour, tbf writing into a compressed format takes time too, but saves you managing databases (unless you want to, just presenting some alternates)

Could look at a document db, again, will take time to ingest and index, but definitely another tool, I’ve touched elastic and stood up mongo before, but Solr is around and built on top of lucene which I knew elastic was but apparently so is mongo.

Edit: searchable? I’d look into a document db, it’s quite literally what they’re meant for, all of those I mentioned are used for enterprise search.

permalink
report
parent
reply
4 points

Importing that data into a RDBMS would be ideal. I’d use PostgreSQL for this but any other would work.

permalink
report
reply
3 points
*

Postgres runs well in a container in my experience and is nice to work with, def support that. I know sqlite works well, no complaints from me

permalink
report
parent
reply
3 points

Nushell can be helpful to sift through structured data: https://www.nushell.sh/

You can just open a csv file and filter and select what you want.

permalink
report
reply

Self Hosted - Self-hosting your services.

!selfhost@lemmy.ml

Create post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules

  • No harassment
  • crossposts from c/Open Source & c/docker & related may be allowed, depending on context
  • Video Promoting is allowed if is within the topic.
  • No spamming.
  • Stay friendly.
  • Follow the lemmy.ml instance rules.
  • Tag your post. (Read under)

Important

Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!

  • Lemmy doesn’t have tags yet, so mark it with [Question], [Help], [Project], [Other], [Promoting] or other you may think is appropriate.

Cross-posting

If you see a rule-breaker please DM the mods!

Community stats

  • 323

    Monthly active users

  • 132

    Posts

  • 303

    Comments