Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-Tenancy with Clojure & Datomic

What (if any) are the current options for Clojure, Datomic and multi-tenancy? Is this the sort of thing that leveraging existing Java libraries would be useful for? Or would there be a more straight forward way of applying a roll-you-own solution in Clojure?

I'm completely new to Datomic and Clojure and would be open to any new paradigms of how they might solve this problem efficiently. I'm interested in all tenanting options, but if more information is really needed, then at this early juncture I'm leaning towards:

  • Single DB
  • Multiple tenants sharing the same tables and have partitioned data through unique tenant keys
like image 325
duncsoz Avatar asked Feb 02 '14 19:02

duncsoz


1 Answers

The simplest thing you could do is to put a tenant key attribute on each of your entities. Then for any query you want to do, you can constrain it by tenant key:

[:find ?n
 :where
 [?c :account/name ?n]
 [?c :tenant/key :tenant.key/acme]]
like image 153
ZAThomas Avatar answered Oct 17 '22 16:10

ZAThomas