Skip to content

Commit 6fb34ad

Browse files
resolved merge conflict
2 parents 997205b + d9a83d1 commit 6fb34ad

File tree

9 files changed

+4636
-62
lines changed

9 files changed

+4636
-62
lines changed

module-1/Importing-Exporting-Data/your-code/.ipynb_checkpoints/main-checkpoint.ipynb

Lines changed: 1411 additions & 0 deletions
Large diffs are not rendered by default.

module-1/Importing-Exporting-Data/your-code/main.ipynb

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,91 @@
2020
},
2121
{
2222
"cell_type": "code",
23+
<<<<<<< HEAD
2324
"execution_count": 2,
2425
"metadata": {},
2526
"outputs": [],
2627
"source": [
2728
"# your code here"
29+
=======
30+
"execution_count": 3,
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"import pandas as pd\n",
35+
"import os\n",
36+
"\n",
37+
"LOG = os.getenv('SQL_LOG')\n",
38+
"PWD = os.getenv('SQL_PWD')"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": 4,
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"import pymysql\n",
48+
"from sqlalchemy import create_engine\n",
49+
"\n",
50+
"engine = create_engine(f'mysql+pymysql://{LOG}:{PWD}@localhost/sakila')\n"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 5,
56+
"metadata": {},
57+
"outputs": [],
58+
"source": [
59+
"sql = '''SELECT * \n",
60+
"FROM sakila.film_actor\n",
61+
"LEFT JOIN sakila.actor\n",
62+
"ON sakila.film_actor.actor_id = sakila.actor.actor_id'''\n",
63+
"data = pd.read_sql_query(sql, engine)"
64+
]
65+
},
66+
{
67+
"cell_type": "code",
68+
"execution_count": 6,
69+
"metadata": {},
70+
"outputs": [
71+
{
72+
"name": "stdout",
73+
"output_type": "stream",
74+
"text": [
75+
" actor_id film_id last_update actor_id first_name last_name \\\n",
76+
"0 1 1 2006-02-15 05:05:03 1 PENELOPE GUINESS \n",
77+
"1 1 23 2006-02-15 05:05:03 1 PENELOPE GUINESS \n",
78+
"2 1 25 2006-02-15 05:05:03 1 PENELOPE GUINESS \n",
79+
"3 1 106 2006-02-15 05:05:03 1 PENELOPE GUINESS \n",
80+
"4 1 140 2006-02-15 05:05:03 1 PENELOPE GUINESS \n",
81+
"... ... ... ... ... ... ... \n",
82+
"5457 200 879 2006-02-15 05:05:03 200 THORA TEMPLE \n",
83+
"5458 200 912 2006-02-15 05:05:03 200 THORA TEMPLE \n",
84+
"5459 200 945 2006-02-15 05:05:03 200 THORA TEMPLE \n",
85+
"5460 200 958 2006-02-15 05:05:03 200 THORA TEMPLE \n",
86+
"5461 200 993 2006-02-15 05:05:03 200 THORA TEMPLE \n",
87+
"\n",
88+
" last_update \n",
89+
"0 2006-02-15 04:34:33 \n",
90+
"1 2006-02-15 04:34:33 \n",
91+
"2 2006-02-15 04:34:33 \n",
92+
"3 2006-02-15 04:34:33 \n",
93+
"4 2006-02-15 04:34:33 \n",
94+
"... ... \n",
95+
"5457 2006-02-15 04:34:33 \n",
96+
"5458 2006-02-15 04:34:33 \n",
97+
"5459 2006-02-15 04:34:33 \n",
98+
"5460 2006-02-15 04:34:33 \n",
99+
"5461 2006-02-15 04:34:33 \n",
100+
"\n",
101+
"[5462 rows x 7 columns]\n"
102+
]
103+
}
104+
],
105+
"source": [
106+
"print(data)"
107+
>>>>>>> d9a83d1b53986889da694ea6186d7de8b05ec30f
28108
]
29109
},
30110
{

0 commit comments

Comments
 (0)