Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kafka-Studies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
최석원
kafka-Studies
Commits
eb47196f
Unverified
Commit
eb47196f
authored
4 years ago
by
Seok Won
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused codes
parent
2d58d50f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/src/AjouSlackProducerMySQL.py
+0
-19
0 additions, 19 deletions
python/src/AjouSlackProducerMySQL.py
python/tests/test_mysql.py
+11
-0
11 additions, 0 deletions
python/tests/test_mysql.py
with
11 additions
and
19 deletions
python/src/AjouSlackProducerMySQL.py
+
0
−
19
View file @
eb47196f
...
...
@@ -2,8 +2,6 @@ import datetime
import
json
import
os
import
time
from
contextlib
import
contextmanager
from
pathlib
import
Path
import
mysql.connector
import
requests
...
...
@@ -22,23 +20,6 @@ def acked(err, msg):
print
(
"
Message produced: {0}...
"
.
format
(
msg
.
value
()))
@contextmanager
def
OPEN_DB
():
# connect to my local MySQL instance using connection string
db
=
mysql
.
connector
.
connect
(
host
=
"
localhost
"
,
user
=
os
.
environ
[
"
MYSQL_USER
"
],
password
=
os
.
environ
[
"
MYSQL_PASSWORD
"
],
database
=
"
ajou_notices
"
,
charset
=
"
utf8
"
,
)
cursor
=
db
.
cursor
(
buffered
=
True
)
yield
cursor
db
.
commit
()
# always commits
cursor
.
close
()
db
.
close
()
def
checkOldness
(
db
):
pass
...
...
This diff is collapsed.
Click to expand it.
python/tests/test_mysql.py
+
11
−
0
View file @
eb47196f
...
...
@@ -110,6 +110,17 @@ def test_updateDB():
assert
row
is
not
None
def
test_printDB
():
with
OPEN_DB
()
as
cursor
:
cursor
.
execute
(
"
SELECT * FROM notices ORDER BY id
"
)
# query = SELECT * FROM testdb.notices LIMIT 3;
for
row
in
cursor
:
print
(
row
)
assert
row
is
not
None
def
test_lastparsed
():
"""
Test LAST_PARSED update
"""
from
datetime
import
datetime
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment