- serialization/deserialization symmetry
- in general need more formatting options OR go to/from a major interchange format and recommend a separate library for every other kind of format in/out.
- But need to support at least one text-based in/out so that we can easily print to inspect a graph
- Why does
rx.node_link_json
requirestr
values in the node and edge payloads, when JSON supports several other data types? This makes deserialization awkward and error-prone, so for now I'm just converting the nodes to{'json': json.dumps(node_payload)}
. - no
node_index_map()
? So you have this clunky interface where you can get either the indices or the data but not both subgraph()
resets node indices 😱🤯add_nodes_from()
should just be calledadd_nodes()
, same foradd_edges_from()
compose()
accepts an edge map which prevents having multiple edges from one node in the main graph to multiple nodes in the added fragment. Instead, it should accept an edge list in the same format used by
This file contains 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
# Copied from: https://stackoverflow.com/a/23689767 | |
class dotdict(dict): | |
"""dot.notation access to dictionary attributes""" | |
__getattr__ = dict.get | |
__setattr__ = dict.__setitem__ | |
__delattr__ = dict.__delitem__ | |
From Leo via slack on Jan 3rd, 2020 in #graphql channel:
This is the script you should run in order to delete all of the GraphQL metadata for the current DB (it won't delete any actual data):
// Remove GraphQL metadata from Collections, Functions, and Indexes
Foreach(Paginate(Collections(), {size:10000}), Lambda('ref', Update(Var('ref'), {data: {gql: null}})))
Foreach(Paginate(Functions(), {size:10000}), Lambda('ref', Update(Var('ref'), {data: {gql: null}})))
Foreach(Paginate(Indexes(), {size:10000}), Lambda('ref', Update(Var('ref'), {data: {gql: null}})))
This file contains 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 gym | |
class FlattenAction(gym.ActionWrapper): | |
"""Action wrapper that flattens the action.""" | |
def __init__(self, env): | |
super(FlattenAction, self).__init__(env) | |
self.action_space = gym.spaces.utils.flatten_space(self.env.action_space) | |
def action(self, action): | |
return gym.spaces.utils.unflatten(self.env.action_space, action) |
> CreateIndex({
name: 'users_by_messageSentAt_desc',
source: Collection('messages'),
values: [
{field: ['data','sentAt'], reverse: true},
{field: ['data','fromUser']}
]
})
This file contains 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
const util = require('util'); | |
const _ = require('lodash'); | |
const mailgun = require("mailgun-js"); | |
async function queryByCustomData(data) { | |
let mg = mailgun({apiKey: process.env.MAILGUN_API_KEY}); | |
let asyncGet = util.promisify(_.bind(mg.get, mg)); | |
let response = await asyncGet(`/YOUR_MAIL_DOMAIN/events`, { | |
"user-variables": JSON.stringify(data), | |
}); |
- Create & attach volume in AWS console (must be in same availability zone).
- From your ec2 instance, list attached volumes:
sudo fdisk -l
- Find the disk in the list and copy it's identifier to your clipboard, e.g.
/dev/nvme1n1
. - If it's a brand new volume, you probably need to format it:
Don't do this to a volume with data on it, or else it won't have data on it anymore. You can skip this step and come back to it if you get an error aboutwrong fs type
when trying tomount
the disk.
Fauna doesn't (yet?) provide guaranteed expiration/TTL for ABAC tokens, so we need to implement it ourselves if we care about it.
3 javascript functions, each of which can be imported into your project or run from the command-line
using node path/to/script.js arg1 arg2 ... argN
:
deploy-schema.js
: a javascript function for creating supporting collections and indexes in your Fauna database.
- use Auth0 for logins
- retrieve a Fauna instance secret for the user (see Fauna's ABAC tutorial)
- have the user’s device talk directly to Fauna's native graphql endpoint using their secret for authorization.
At the very least, we need two pieces of functionality:
- Create a user document in Fauna to represent each Auth0 user.
- Exchange an Auth0 JWT for a FaunaDB user secret.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder