This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- a version of response in https://dba.stackexchange.com/questions/56096/how-to-get-all-roles-that-a-user-is-a-member-of-including-inherited-roles | |
| select usename, rolname from pg_user | |
| join pg_auth_members on (pg_user.usesysid=pg_auth_members.member) | |
| join pg_roles on (pg_roles.oid=pg_auth_members.roleid) | |
| order by rolname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- a version of response by @SahapAsci in https://dba.stackexchange.com/questions/155332/find-objects-linked-to-a-postgresql-role | |
| with d as ( | |
| SELECT | |
| n.nspname AS schema_name, | |
| c.relname AS rel_name, | |
| c.relkind AS rel_kind, | |
| pg_get_userbyid(c.relowner) AS owner_name | |
| FROM pg_class c | |
| JOIN pg_namespace n ON n.oid = c.relnamespace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnDestroy, OnInit } from '@angular/core'; | |
| import { HttpClient } from '@angular/common/http'; | |
| import { AgGridModule } from 'ag-grid-angular'; | |
| @Component({ | |
| templateUrl: 'myobject.component.html' | |
| }) | |
| export class MyObjectComponent implements OnInit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(RForcecom) | |
| library(httr) | |
| session <- rforcecom.login(<username?, | |
| sprintf("%s%s", <password>, <securitytoken>)) | |
| httr.headers <- add_headers(Authorization=sprintf("Bearer %s", session["sessionID"])) | |
| # unlike in simple_salesforce, full url should be provided here | |
| url <- file.path(session["instanceURL"], | |
| "services", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from simple_salesforce import Salesforce | |
| sf = Salesforce(username=..., | |
| password=..., | |
| security_token=...) | |
| # SOQL | |
| sf.query(<soql>) | |
| # REST | |
| # omit https://.../services/data/apiversion prefix from url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://gist.github.com/curran/b595fde4d771c5784421 without histograms and with an axis | |
| // created to mimick R density function with a default gaussian kernel and nrd bandwidth computation | |
| // Based on http://bl.ocks.org/900762 by John Firebaugh | |
| // data.json contains an array of floating points between 0-1 | |
| d3.json("data.json", function(faithful) { | |
| data = faithful; | |
| var w = 960, | |
| h = 500, | |
| margin = {top: 20, right: 30, bottom: 30, left: 40}, | |
| x = d3.scaleLinear().domain([-0.1, 1.1]).range([margin.left, w - margin.right]), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- https://www.postgresql.org/docs/9.3/static/indexes-unique.html | |
| CREATE UNIQUE INDEX $indexname ON ("($jsoncolumn ->> $jsonkey::text)", $column2, ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- https://stackoverflow.com/questions/343138/retrieving-comments-from-a-postgresql-db | |
| SELECT col.table_name,col.column_name, pgd.description, col.data_type | |
| FROM pg_catalog.pg_statio_all_tables AS st | |
| INNER JOIN pg_catalog.pg_description pgd ON (pgd.objoid=st.relid) | |
| INNER JOIN information_schema.columns col ON (pgd.objsubid=col.ordinal_position | |
| AND col.table_schema=st.schemaname AND col.table_name=st.relname) | |
| WHERE col.table_schema = $schema_name; |