Where is the schema defined?
- Source code: glean/schema/source
Thrift types generated from the schema
The schema is compiled into Thrift files and language-specific support code, which can be used directly by clients for querying Glean. This means that you can query Glean using native types and data structures in whatever language you're using.
The Thrift files are generated by
In the root of the Glean repository. This puts files in
glean/schema/thrift, which are then processed into Haskell code by
and finally built by
Examples of code using these types:
- Haskell: glean/client/hs/example/Example.hs
Experimenting with schemas
Modify the source files in glean/schema/source
Start up the shell locally using your schema:
glean shell --db-root ~/local/gleandb --schema glean/schema/source
If you don't already have a
~/local/gleandbfor storing local DBs, create it with
Test it with some example data: see Loading a DB from JSON in the shell.
Iterate as necessary, using
:reloadin the shell to reload the schema.