repl.it
Python

Create, read, update and delete

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from functorflow import ff

address = '7672aa441a361eb15d325acbabac75211e66455f3c68f7db9299d9c0435f90aa'

crud = ff.crud.new(address=address)

crud.create('users', 0, {'username': 'satoshi', 'profession': 'hacker' })

crud.create('users', 1, {'username': 'johndoe', 'profession': 'programmer' })

crud.create('users', 2, {'username': 'alex', 'profession': 'data scientist' })

alex = crud.read('users', 2)
print(alex['profession'])


all_users = crud.read('users')
print(all_users)

crud.update('users', 1, 'username', 'sam')
crud.update('users', 1, 'hobby', 'reading')

print(crud.read('users', 1)) # sam

crud.delete('users', 2)

print(crud.read('users', 2))