Introduction to NoSQL
Jake Roach
Data Engineer
{
'guardian': 'mother',
'status': 'A',
'educations': [4, 4],
'jobs': {
'P1': 'teacher',
'P2': 'at_home'
}
}
CREATE TABLE students
<column-name> JSON,
<column-bame> JSONB
;
JSON
$$
JSONB
SELECT
address,
famsize,
...
FROM students
[WHERE | GROUP BY | ORDER BY];
$$
row_to_json
, json_to_record
->
, ->>
, #>
, #>>
operatorsjson_extract_path
, json_extract_path_text
We'll also be able:
import sqlalchemy
import pandas as pd
# Create a connection
db_engine = sqlalchemy.create_engine(
"postgresql+psycopg2://<user>:<password>@<host>:5432/<database>"
)
# Write a query
query = "SELECT * FROM table_name;"
# Execute the query, show results
results = pd.read_sql(query, db_engine)
Introduction to NoSQL