This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-31
Channels
- # aleph (9)
- # bangalore-clj (1)
- # beginners (115)
- # cider (16)
- # clara (20)
- # cljs-dev (47)
- # cljsrn (50)
- # clojure (70)
- # clojure-dusseldorf (2)
- # clojure-italy (16)
- # clojure-sanfrancisco (1)
- # clojure-spec (9)
- # clojure-uk (37)
- # clojurescript (132)
- # cursive (21)
- # datomic (36)
- # dirac (53)
- # fulcro (34)
- # graphql (6)
- # hoplon (96)
- # jobs (2)
- # juxt (2)
- # keechma (2)
- # leiningen (5)
- # off-topic (3)
- # om (2)
- # om-next (3)
- # parinfer (3)
- # re-frame (17)
- # remote-jobs (1)
- # shadow-cljs (57)
- # specter (12)
- # sql (43)
- # unrepl (11)
- # yada (5)
@stuarthalloway I’d love to use this on a private project, though do I need to be worried about licensing? https://github.com/Datomic/mbrainz-importer/blob/5d2d90f9a35789824675a4cc86a9a433527cb41b/src/cognitect/xform/spec.clj
Has anyone seen any attempts to turn a postgres schema into a set of clojure specs so you can generate data like whats in the database? Or vise versa, fill the database with data? In the case where your using postgres or a relational db, would that be helpful?
@drewverlee at one point I did the same thing with a Datomic schema. It was probably simpler because of the natural Datomic/Clojure match, but I'd definitely think you could do the same with a relational DB. You might want to think about what you'd want the specs to capture -- type is the obvious low-hanging fruit, but there might be other stuff. And you could probably capture the set of fields present in each table with s/keys
. Possibly other stuff depending on your particular schema, but in my experience worth considering well in advance of taking on the conversion.
@eggsyntax i’m thinking either this sort of thing already exists (maybe in another language) or there are really good reasons why its not useful. But maybe clojure spec opens some new doors.
it doesn’t take care of traversing the schema, but you can run your data through this to get specs out of them: https://github.com/stathissideris/spec-provider
(my project btw, so I’m here for questions)
I’m pretty sure someone has probably done this already for jdbc based on your databasemetadata, and maybe that’s 90% of the work
don’t think I’ve seen it specifically with spec though