-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example use sql #4
Comments
--- EXTRACT fieldname and fieldtype - where there is only one type of doc
-- show equivelent couchdb map / reduce WITH flds AS ( fieldmeta AS (SELECT f as fname, json_typeof(to_json(doc)->f) as ftype SELECT * FROM fieldmeta -- i suspect there may be a simpler way todo this by grabbing one doc and use json functions to extract the info |
--- EXTRACT fieldname and fieldtype - where there is more than one type of doc show equivelent couchdb map / reduce WITH flds AS (SELECT DISTINCT doc->>'type' as doctype, jsonb_object_keys(doc) AS f, 'text' AS t FROM articlespg), SELECT DISTINCT doctype, fname, |
Do a wiki/readme page of example sql queries eg:
SELECT DISTINCT doc->>'type' as doctype, count(doc->>'type')
FROM mytable GROUP BY doctype ORDER BY doctype
And any things which might bite like the ORDER BY issue
The text was updated successfully, but these errors were encountered: