Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flask_databasemigration
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Masarath Fatima
Flask_databasemigration
Commits
3e672e19
Commit
3e672e19
authored
Jan 27, 2022
by
Masarath Fatima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete mysql1.py
parent
004823d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
39 deletions
+0
-39
mysql1.py
...ons/flaskdatabasemigrations/onpremisesdatabases/mysql1.py
+0
-39
No files found.
flaskdatabasemigrations/flaskdatabasemigrations/onpremisesdatabases/mysql1.py
deleted
100644 → 0
View file @
004823d4
import
pandas_gbq
as
pd_gbq
import
pandas
as
pd
import
pymysql
class
MSQLPOOl
:
def
get_connection
(
self
,
db_host
,
db_user
,
db_pass
):
try
:
conn
=
pymysql
.
connect
(
host
=
db_host
,
user
=
db_user
,
password
=
db_pass
,
)
except
Exception
as
e
:
print
(
e
)
else
:
return
conn
def
read_and_prepare_data
(
self
,
db_name
,
table
,
conn
):
try
:
query
=
"SELECT * FROM {0}.{1} ;"
.
format
(
db_name
,
table
)
df
=
pd
.
read_sql
(
query
,
conn
)
except
Exception
as
e
:
print
(
e
)
else
:
return
df
def
load_into_bq
(
self
,
df
,
table_id
,
project_id
,
schema_json
):
try
:
pd_gbq
.
to_gbq
(
df
,
table_id
,
project_id
=
project_id
,
table_schema
=
schema_json
,
if_exists
=
'replace'
)
except
Exception
as
e
:
print
(
e
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment