insert statement in rethinkdb and python

Solutions on MaxInterview for insert statement in rethinkdb and python by the best coders in the world

showing results for - "insert statement in rethinkdb and python"
Andrés
02 Oct 2017
1#pip3 install rethinkdb
2
3from rethinkdb import r
4
5connection = r.connect()
6r.db_create('superheroes').run(connection)
7
8
9r.table_create('marvel').run(connection)
10
11marvel_heroes = r.table('marvel')
12marvel_heroes.insert({
13    'id': 1,
14    'name': 'Iron Man',
15    'first_appearance': 'Tales of Suspense #39'}).run(connection)
16
17for hero in marvel_heroes.run(connection):
18    print(hero['name'])