# -*- coding: utf-8 -*-
"""DS7_mongoDB.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1MAfFghkorF7_b3SdcBQbMeMp4gJMBa06

username: admin
password: <PASSWORD>
"""

!curl ipecho.net/plain

import sys
print(sys.version)

!pip install pymongo
import pymongo

# full driver from mongodb
client = pymongo.MongoClient("mongodb://admin:7xpCfXxWjVv2QgRK@cluster0-shard-00-00-kibgi.mongodb.net:27017,cluster0-shard-00-01-kibgi.mongodb.net:27017,cluster0-shard-00-02-kibgi.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority")
db = client.test

db

# check how many machines
client.nodes

from google.colab import files
files.upload()

import sqlite3

conn = sqlite3.connect('rpg_db.sqlite3')

curs = conn.cursor()

characters = curs.execute('SELECT * FROM charactercreator_character').fetchall()

characters[0][1]

curs.execute('PRAGMA table_info(charactercreator_character);').fetchall()

for character in characters:
    db.test.insert_one({
        'character_id': character[0],
        'name': character[1],
        'level': character[2],
        'exp': character[3],
        'hp': character[4],
        'strength': character[5],
        'intelligence': character[6],
        'dexterity': character[7],
        'wisdom': character[8]
    })

"""
How was working with MongoDB different from working with PostgreSQL? What was easier, and what was harder?

Working with mongoDB seems easier than PostgreSQL just beacuase there is less steps and is very straight forward
in the way that it functions.
"""
# -*- coding: utf-8 -*-
"""DS7_mongoDB.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1MAfFghkorF7_b3SdcBQbMeMp4gJMBa06

username: admin
password: <PASSWORD>
"""

!curl ipecho.net/plain

import sys
print(sys.version)

!pip install pymongo
import pymongo

# full driver from mongodb
client = pymongo.MongoClient("mongodb://admin:7xpCfXxWjVv2QgRK@cluster0-shard-00-00-kibgi.mongodb.net:27017,cluster0-shard-00-01-kibgi.mongodb.net:27017,cluster0-shard-00-02-kibgi.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority")
db = client.test

db

# check how many machines
client.nodes

from google.colab import files
files.upload()

import sqlite3

conn = sqlite3.connect('rpg_db.sqlite3')

curs = conn.cursor()

characters = curs.execute('SELECT * FROM charactercreator_character').fetchall()

characters[0][1]

curs.execute('PRAGMA table_info(charactercreator_character);').fetchall()

for character in characters:
    db.test.insert_one({
        'character_id': character[0],
        'name': character[1],
        'level': character[2],
        'exp': character[3],
        'hp': character[4],
        'strength': character[5],
        'intelligence': character[6],
        'dexterity': character[7],
        'wisdom': character[8]
    })

"""
How was working with MongoDB different from working with PostgreSQL? What was easier, and what was harder?

Working with mongoDB seems easier than PostgreSQL just beacuase there is less steps and is very straight forward
in the way that it functions.
"""
# -*- coding: utf-8 -*- DS7_mongoDB.ipynb  Automatically generated by Colaboratory.  Original file is located at     https://colab.research.google.com/drive/1MAfFghkorF7_b3SdcBQbMeMp4gJMBa06  username: admin password: <PASSWORD> # full driver from mongodb # check how many machines How was working with MongoDB different from working with PostgreSQL? What was easier, and what was harder?  Working with mongoDB seems easier than PostgreSQL just beacuase there is less steps and is very straight forward in the way that it functions.