DEV Community

Cover image for Meet Datomic: the immutable and functional database.

Meet Datomic: the immutable and functional database.

guto on April 15, 2024

"When you combine two pieces of data you get data. When you combine two machines you get trouble." - Rich Hickey presenting The Functional Databas...
Collapse
 
miketalbot profile image
Mike Talbot ⭐ • Edited

I'm hoping there is a way that you can actually delete data somewhere though? Otherwise this would end up being very, very hard to use for a range of use cases.

People frequently add data that they shouldn't to databases, information that it is dangerous or illegal to store because it exposes the the party holding the data to significant legal and financial penalties. For example, in a system I used to run, people upload pictures of their passports by accident, if deleting that picture didn't actually remove it from the database entirely - this would be a significant issue. Any business that is ISO 27001 certified would have to demonstrate at audit that full removal was possible and reasonably efficient. I know this because we had an event (immutable) database that the information was in, and it took whole reimports to remove this stuff.

In the EU we have GDPR, which includes the right to be forgotten and the right to see all information held about us. This isn't just the most recent information in the database, it is all of the information.

Event based databases have some very interesting characteristics, it would be great to find one that actually could handle real deletion without hoop jumping.

Collapse
 
dyfet profile image
David Sugar

I recall when svn tried promoting immutability as a feature ;).

But there are plenty of actual potential applications for immutable data systems, such as event logs, call detail records, etc, that need the ability to be queried and are often not public facing, but may also face legal mandates to preserve data. The solution to something security related somehow getting into such a system is to have the query / viewer scrub it, rather than to modify the stored data. Many of these kinds of systems historically used encoded binary data, too.

Collapse
 
guto profile image
guto • Edited

Exactly! By default all data managed by Datomic is encrypted and stored in a byte array format. Every writing transaction needs the configured transactor, in addition to needing a peer to read the data.

Furthermore, for privacy reasons you can delete datoms using an excision (docs.datomic.com/pro/reference/exc...). But, in your opinion, what is the general applicability for using immutable data, beyond the example you said about svn? And what would be the possible problems to be faced in this architecture?

Collapse
 
guto profile image
guto • Edited

Sure! You can completely remove datoms using an excision (docs.datomic.com/pro/reference/exc...). It is completely understandable, after all, in Brazil for example, there is the General Data Protection Law (LGPD), responsible for working with data privacy rights.

In one of the next articles in this series I will demonstrate how to use excisions! I hope you enjoy!

Collapse
 
miketalbot profile image
Mike Talbot ⭐

That's great! Thanks for the info :)

Collapse
 
j0suetm profile image
J0sueTM

Definitely a great read!

Collapse
 
suamirochadev profile image
Suami Rocha

Best content!!! 🚀

Collapse
 
cherryramatis profile image
Cherry Ramatis

I read about Datomic a long time ago, and it never clicked with me. Now, with your awesome didactics, I'm starting to understand it.

Hope to read further continuation of the series! 🫶

Collapse
 
ozzythegiant profile image
Oziel Perez

Why does everything have to be functional nowadays. Let objects be objects!

Collapse
 
guto profile image
guto

It's not about bring functional programming in general, but, the possibility to apply functional concepts into OOP. I will recommend this article written by @cherryramatis about exactly this: dev.to/cherryramatis/ending-the-wa...

And of course, if you don't like this idea, you can write about this by yourself and make propositions to defend this! Be free :)

Collapse
 
joekiller profile image
Joseph Lawson

"Developed in 2010" to compliment a lisp based language released in 2007.

So kinda not just something from nowadays but instead a mature technology getting some coverage.

Functional programming typically exhibits a preference of immutable data operation vs the encapsulation of complexity in oop.

The approaches are different. OOP shields from complexity with object contracts. Functional programming applies a core set of methods yielding programs wrapped around the data and business need.

Whether one aheres to the inherit qualities of the languages is left up to the user.