Establish Database Connections from Python

Published by onesixx on

https://appsilon.com/post/shiny-for-python-databases-mysql-postgres

df = pd.read_sql(stmt, con=conn)

Oralce

https://hub.docker.com/r/gvenzl/oracle-xe

docker pull gvenzl/oracle-xe:latest

Run a new persistent database container (data is kept throughout container lifecycles):

docker run -d -p 1521:1521 -e ORACLE_PASSWORD=password -v oracle-volume:/opt/oracle/oradata gvenzl/oracle-xe
❯ docker exec -it compassionate_shirley /bin/bash

bash-4.4$ cd /opt/human_resources/
bash-4.4$ ls -al
total 104
drwxrwxr-x 2  501 games  4096 Mar 28 16:32 .
drwxr-xr-x 1 root root   4096 May 19 11:54 ..
-rw-rw-r-- 1  501 games  2642 Mar 28 16:32 README.md
-rw-rw-r-- 1  501 games  2666 Mar 28 16:32 README.txt
-rw-rw-r-- 1  501 games  3849 Mar 28 16:32 hr_code.sql
-rw-rw-r-- 1  501 games 17112 Mar 28 16:32 hr_create.sql
-rw-rw-r-- 1  501 games  8275 Mar 28 16:32 hr_install.sql
-rw-rw-r-- 1  501 games 41301 Mar 28 16:32 hr_populate.sql
-rw-rw-r-- 1  501 games  2920 Mar 28 16:32 hr_uninstall.sql


bash-4.4$ cd /opt/oracle/product/21c/dbhomeXE
bash-4.4$ cd demo/shema
bash-4.4$ pwd
/opt/oracle/product/21c/dbhomeXE/demo/schema


bash-4.4$ cp -rf /opt/human_resources/ ./
❯ docker exec -it compassionate_shirley sqlplus

SQL> @?/demo/schema/human_resources/hr_create.sql
Categories: shiny

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x