Skip to content

Instantly share code, notes, and snippets.

Tanmai Gopal coco98

Block or report user

Report or block coco98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@coco98
coco98 / track_all_tables.py
Created Jan 30, 2020
Track tables in python (Hasura)
View track_all_tables.py
import requests
#Fetch existing tables
tables = requests.post('http://localhost:8080/v1/query', json={
"type":"select",
"args":{
"table": {"schema": "information_schema", "name": "tables"},
"columns": ["table_name"],
"where": {"table_schema": {"$eq": "public"}}
}
@coco98
coco98 / update-relationships.graphql
Last active Mar 13, 2019
single mutation to update relationships
View update-relationships.graphql
#Without query variables
mutation updateChildren {
delete_children(where: {parent_id: {_eq: 1}}) {
affected_rows
}
insert_children(objects: [{name: "child1", parent_id: 1}, {name: "child2", parent_id: 1}]) {
affected_rows
}
@coco98
coco98 / chinook_hasura_postgres_db.sql
Created Jan 15, 2019
Chinook dataset to be imported into postgres - ideal for hasura demo
View chinook_hasura_postgres_db.sql
This file has been truncated, but you can view the full file.
-- -- /*******************************************************************************
-- -- Chinook Database - Version 1.4
-- -- Script: Chinook_PostgreSql.sql
-- -- Description: Creates and populates the Chinook database.
-- -- DB Server: PostgreSql
-- -- Author: Luis Rocha
-- -- License: http://www.codeplex.com/ChinookDatabase/license
View sample.json
{
"user": [
{
"id": 456,
"name": "Sita K",
"address": {
"country": "India"
}
},
{
View insert-message.graphql
mutation($message: messages_insert_input!) {
insert_messages(objects:[$message]) {
returning {
id
sender_id
message
}
}
}
View insert-message.graphql
mutation($message: messages_insert_input!) {
insert_messages(objects:[$message]) {
returning {
id
sender_id
message
}
}
}
@coco98
coco98 / elgordino-hasura.tf
Created Dec 19, 2018
Terraform spec for Hasura on Fargate and RDS
View elgordino-hasura.tf
provider "aws" {
region = "${var.region}"
}
### VPC
# Fetch AZs in the current region
data "aws_availability_zones" "available" {}
resource "aws_vpc" "datastore" {
cidr_block = "172.17.0.0/16"
View func-conf.hs
-- AST1
data ColExpression = ColE ColName [OperationExpression]
data BoolExpression = BECol ColExpression
data BoolExpression
= BEAnd [BoolExpression]
| BEOr [BoolExpression]
| BENot BoolExpression
| BECol ColExpression
View func-conf.js
// Boolean expression for a column
"column": {
"_eq": "value",
"_gt": "value"
}
// AND expression
"and": {
"column1": {...},
You can’t perform that action at this time.