|
|
|
|
|
by weavejester
2615 days ago
|
|
I'm not talking about building a database; I'm talking about using a relational model for data. Like most general-purpose programming languages, Clojure has a hierarchical data model. We have a number of collection types, and we can put any collection into any other collection. A relational model takes a fundamentally different approach. Relational data is represented not by nesting collections, but by a flat set of tuples. Efficiency is achieved through indexing, not by rearranging collections. There's some interesting research around on using the relational model outside of a database, but that's not a design goal of Clojure. |
|
```clojure
(def table01 {:t1-pk1 {:pk :t1-pk1
(def t1-manager-index {:m1 #{:t1-pk1} (->> :m2 ; =>; {:t1-pk2 {:pk :t1-pk2, :name "t1-r2", :manager :m2},
; :t1-pk4 {:pk :t1-pk4, :name "t1-r4", :manager :m2}}
(->> [:m2 :m3]
; =>; {:t1-pk2 {:pk :t1-pk2, :name "t1-r2", :manager :m2},
; :t1-pk4 {:pk :t1-pk4, :name "t1-r4", :manager :m2},
; :t1-pk3 {:pk :t1-pk3, :name "t1-r3", :manager :m3}}
```
Your point of view is mainly to emphasize that Clojure is a multi-paradigm, general-purpose functional programming language.
The postgresql development team is also this view, so postgresql is not only RMDB (relational modeling), but also supports OO and json (NoSQL). But postgresql default data modeling is relational modeling
My point of view is mainly to emphasize the best practices of data modeling and programming.
Both views are correct and can exist in parallel.