Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Conversation

sudharsana-kjl
Copy link
Contributor

This PR hopes to add a feature to work with data from a mysql database.

@johnandersen777
Copy link

johnandersen777 commented Jul 9, 2019

import unittest

from dffml.util.testing.source import SourceTest
from dffml.util.asynctestcase import AsyncTestCase

from dffml.source.mysql import MysqlSourceConfig, MysqlSource


class TestMysqlSource(SourceTest, AsyncTestCase):
    async def setUpSource(self):
        return MysqlSource(
            MysqlSourceConfig(... parameters, get from os.getenv ...)
            # user=os.getenv("MYSQL_USER")
            # password=os.getenv("MYSQL_PASSWORD")
        )

    @unittest.SkipIf(os.getenv("MYSQL_USER", default=None) is None, "Need MYSQL_ env variables to run MySQL Source tests")
    async def test_update():
        await super().test_update()

We will start a mysql database within travis CI and set environment variables the same way we start the database, aka, same MYSQL_USER, MYSQL_PASSWORD from docker hub docs: @pdxjohnny will do this for travis.

@johnandersen777
Copy link

To have aiomysql installed for testing, add to setup.py

    # ...
    packages=find_packages(),
    install_requires=[
        "aiomysql>=Go find the latest version number of PyPi and put it here",
    ],
    include_package_data=True,
    # ...

@codecov-io
Copy link

codecov-io commented Jul 10, 2019

Codecov Report

Merging #114 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #114   +/-   ##
=======================================
  Coverage   92.79%   92.79%           
=======================================
  Files          57       57           
  Lines        3537     3537           
  Branches      408      408           
=======================================
  Hits         3282     3282           
  Misses        198      198           
  Partials       57       57

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a459b3...39512c3. Read the comment docs.

yield await self.repo(src_url)

async def repo(self, src_url: str):
if self.parent.config.repo_query != "":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repo_query is required, so you don't need to check if it's an empty string

table="repo_data",
repo_query="",
update_query="",
repos_query="",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work unless you set repo_query, update_query, repos_query

@sudharsana-kjl
Copy link
Contributor Author

sudharsana-kjl commented Jul 21, 2019

For testing purpose, SSL certificate was generated using openssl.

openssl genrsa 2048 > private.pem
openssl req -x509 -days 1000 -new -key private.pem -out ca.pem

@lgtm-com
Copy link

lgtm-com bot commented Aug 1, 2019

This pull request introduces 1 alert when merging c791b2c into 26e8313 - view on LGTM.com

new alerts:

  • 1 for Unused import

@johnandersen777 johnandersen777 added this to the 0.2.3 Dot Release milestone Aug 1, 2019
@lgtm-com
Copy link

lgtm-com bot commented Aug 5, 2019

This pull request introduces 1 alert when merging 6c67cee into d4b2a35 - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: John Andersen <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Aug 9, 2019

This pull request introduces 2 alerts when merging 181bf51 into d4b2a35 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Aug 10, 2019

This pull request introduces 2 alerts when merging 67c139b into d4b2a35 - view on LGTM.com

new alerts:

  • 2 for Unused import

pdxjohnny and others added 14 commits August 11, 2019 17:32
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
commit 2a459b3
Author: Yash Lamba <[email protected]>
Date:   Fri Sep 6 22:18:19 2019 +0530

    README: Add black badge

commit 5bf5701
Author: John Andersen <[email protected]>
Date:   Tue Sep 3 14:18:21 2019 -0700

    model: scikit: Fix CLI based configuration

    Signed-off-by: John Andersen <[email protected]>

commit 917d997
Author: John Andersen <[email protected]>
Date:   Tue Sep 3 13:36:02 2019 -0700

    base: Log config on init

    Signed-off-by: John Andersen <[email protected]>

commit f4a5dda
Author: John Andersen <[email protected]>
Date:   Tue Sep 3 08:55:04 2019 -0700

    setup: Not zip safe

    Signed-off-by: John Andersen <[email protected]>

commit 2864a11
Author: John Andersen <[email protected]>
Date:   Wed Aug 28 11:17:51 2019 -0700

    README: Add link to master docs

    Signed-off-by: John Andersen <[email protected]>

commit 47f76b0
Author: Yash Lamba <[email protected]>
Date:   Wed Aug 28 17:15:09 2019 +0530

    model: scikit: Changed self to cls

commit 1823b9e
Author: John Andersen <[email protected]>
Date:   Tue Aug 27 08:48:52 2019 -0700

    service: http: Fix type in securiy docs

    Signed-off-by: John Andersen <[email protected]>

commit c4d5d2f
Author: John Andersen <[email protected]>
Date:   Tue Aug 27 08:39:38 2019 -0700

    service: http: Release HTTP service (intel#182)

    Signed-off-by: John Andersen <[email protected]>

commit 075577a
Author: Pankaj Patil <[email protected]>
Date:   Mon Aug 26 09:04:26 2019 +0530

    examples: source: Rename testcase

    Fixes: intel#117

commit af19211
Author: John Andersen <[email protected]>
Date:   Fri Aug 23 13:44:14 2019 -0700

    setup: Capitalize version and readme

    Signed-off-by: John Andersen <[email protected]>

commit 15597c9
Author: John Andersen <[email protected]>
Date:   Fri Aug 23 13:36:35 2019 -0700

    README: Remove link to HACKING.md

    Signed-off-by: John Andersen <[email protected]>

commit 9fd0c55
Author: John Andersen <[email protected]>
Date:   Fri Aug 23 13:31:57 2019 -0700

    docs: CONTRIBUTING: Merge HACKING

    Fixes: intel#166

    Signed-off-by: John Andersen <[email protected]>

commit ce03f9b
Author: John Andersen <[email protected]>
Date:   Fri Aug 23 12:42:19 2019 -0700

    cli: Enable usage via module invokation

    * Example: $ python3.7 -m dffml list repos

    Signed-off-by: John Andersen <[email protected]>

commit db326cb
Author: John Andersen <[email protected]>
Date:   Thu Aug 22 14:56:34 2019 -0700

    service: dev: List entrypoints

    Signed-off-by: John Andersen <[email protected]>

commit 7d1c6f6
Author: John Andersen <[email protected]>
Date:   Thu Aug 22 14:07:31 2019 -0700

    model: scikit: Correct entrypoints again

    Signed-off-by: John Andersen <[email protected]>

commit bab734e
Author: Yash Lamba <[email protected]>
Date:   Thu Aug 22 05:36:53 2019 +0530

    model: scikit: corrected entry points

    Fixes: intel#165

commit eb9b600
Author: John Andersen <[email protected]>
Date:   Fri Aug 16 13:46:51 2019 -0700

    style: Correct style of all submodules

    * Enforce style in all submodules via ci

    Fixes: intel#173

    Signed-off-by: John Andersen <[email protected]>

commit c9cd3ea
Author: John Andersen <[email protected]>
Date:   Fri Aug 16 11:45:04 2019 -0700

    examples: shouldi: Add dev mode hack

    Fixes: intel#174

    Signed-off-by: John Andersen <[email protected]>

commit 452a182
Author: John Andersen <[email protected]>
Date:   Thu Aug 15 14:48:17 2019 -0700

    news: origin/master August 15 2019

    Signed-off-by: John Andersen <[email protected]>

commit 3d04591
Author: John Andersen <[email protected]>
Date:   Mon Aug 12 18:34:53 2019 -0700

    skel: source: entry_points correction

    * setup() kwargs entry_points was the service entrypoint,
      corrected to the source entrypoint.

    Fixes: intel#162

commit c854e40
Author: Sudharsana K J L <[email protected]>
Date:   Sun Aug 11 09:33:19 2019 +0530

    source: csv: Add label

    Co-authored-by: John Andersen <[email protected]>
    Signed-off-by: John Andersen <[email protected]>

commit 7afd85a
Author: Yash Lamba <[email protected]>
Date:   Sun Aug 11 03:00:45 2019 +0530

    model: scikit: Create models and configs dynamicly

commit d478dee
Author: Saksham Arora <[email protected]>
Date:   Sun Aug 11 02:32:36 2019 +0530

    docs: HACKING: Added logging for testing
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2019

This pull request introduces 6 alerts when merging 39512c3 into 2a459b3 - view on LGTM.com

new alerts:

  • 4 for Unused import
  • 2 for Except block handles 'BaseException'

@johnandersen777 johnandersen777 merged commit c9c3f2d into intel:master Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

more testing Need more testing before this is merged/closed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants