-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (21 loc) · 1023 Bytes
/
main.py
File metadata and controls
26 lines (21 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import streamlit as st
#from migrate import migrate_data
from migrate import migrate_data
st.title("MySQL to MongoDB Migration Tool")
# MySQL input
st.header("MySQL Connection Details")
mysql_host = st.text_input("MySQL Host", "localhost", key="mysql_host")
mysql_user = st.text_input("MySQL User", "root", key="mysql_user")
mysql_password = st.text_input("MySQL Password", type="password", key="mysql_password")
mysql_db = st.text_input("MySQL Database Name", key="mysql_db")
# MongoDB input
st.header("MongoDB Connection Details")
mongo_host = st.text_input("MongoDB Host", "localhost", key="mongo_host")
mongo_port = st.number_input("MongoDB Port", 27017, step=1, key="mongo_port")
mongo_db = st.text_input("MongoDB Database Name", key="mongo_db")
# Migration button
if st.button("Start Migration"):
with st.spinner("Migrating data..."):
result = migrate_data(mysql_host, mysql_user, mysql_password, mysql_db, mongo_host, mongo_port, mongo_db)
st.success("Migration completed!")
st.json(result)