Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handlers import #3986

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/mindsdb-docs/docs/contribute/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ integrations # Contains integrations source codes

In technical terms, a handler is a self-contained Python package having everything required for MindsDB to interact with it. It includes aspects like dependencies, unit tests, and continuous integration logic. It is up to the author to determine the nature of the package, for example, closed or open source, version control, and more. Although, we encourage opening pull requests to expand the default set of supported tools.

The entry point is a class definition that should inherit either from the `integrations.libs.base_handler.DatabaseHandler` class or the `integrations.libs.base_handler.PredictiveHandler` class, depending on the type of the handler. The `integrations.libs.base_handler.BaseHandler` class defines all the methods that must be overwritten in order to achieve a functional implementation.
The entry point is a class definition that should inherit either from the `integrations.libs.base.DatabaseHandler` class or the `integrations.libs.base.PredictiveHandler` class, depending on the type of the handler. The `integrations.libs.base.BaseHandler` class defines all the methods that must be overwritten in order to achieve a functional implementation.

!!! note "Handler's Structure"
The handler's structure is not enforced, and the package design is up to the author.
Expand Down
2 changes: 1 addition & 1 deletion mindsdb/integrations/handlers/hana_handler/hana_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from mindsdb.utilities import log

from mindsdb.integrations.libs.base_handler import DatabaseHandler
from mindsdb.integrations.libs.base import DatabaseHandler
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
HandlerResponse as Response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
from mindsdb_sql.parser.ast.base import ASTNode

from mindsdb.utilities.log import log
from mindsdb.utilities.log import get_log
from mindsdb.integrations.libs.base import DatabaseHandler
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
Expand All @@ -17,6 +17,8 @@
from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE as ARG_TYPE


log = get_log()


class ImpalaHandler(DatabaseHandler):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from mindsdb_sql.parser.ast.base import ASTNode

from mindsdb.utilities.log import log
from mindsdb.utilities.log import get_log
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
HandlerResponse as Response,
Expand All @@ -18,6 +18,9 @@
from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE as ARG_TYPE


log = get_log()


class SheetsHandler(DatabaseHandler):
"""
This handler handles connection and execution of the Airtable statements.
Expand Down
5 changes: 1 addition & 4 deletions mindsdb/integrations/handlers/solr_handler/solr_handler.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
from pickle import FALSE
from typing import Optional
from collections import OrderedDict
import pandas as pd

from sqlalchemy import create_engine
import sqlalchemy_solr


from mindsdb_sql import parse_sql
from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
from mindsdb_sql.parser.ast.base import ASTNode

from mindsdb.utilities import log
from mindsdb.integrations.libs.base_handler import DatabaseHandler
from mindsdb.integrations.libs.base import DatabaseHandler
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
HandlerResponse as Response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from mindsdb_sql.parser.ast.base import ASTNode
from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender

from mindsdb.utilities.log import log

from mindsdb.utilities.log import get_log
from mindsdb.integrations.libs.base import DatabaseHandler
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
Expand All @@ -21,6 +20,9 @@
from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE as ARG_TYPE


log = get_log()


class SQLAnyHandler(DatabaseHandler):
"""
This handler handles connection and execution of the SAP SQL Anywhere statements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
from mindsdb_sql.parser.ast.base import ASTNode

from mindsdb.utilities.log import log
from mindsdb.utilities.log import get_log
from mindsdb.integrations.libs.base import DatabaseHandler
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
Expand All @@ -18,6 +18,7 @@
from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE as ARG_TYPE


log = get_log()


class TDEngineHandler(DatabaseHandler):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from mindsdb.utilities import log

from mindsdb.integrations.libs.base_handler import DatabaseHandler
from mindsdb.integrations.libs.base import DatabaseHandler
from mindsdb.integrations.libs.response import (
HandlerStatusResponse as StatusResponse,
HandlerResponse as Response,
Expand Down
5 changes: 4 additions & 1 deletion mindsdb/integrations/handlers_client/ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
from mindsdb.integrations.handlers_client.base_client import BaseClient
from mindsdb.integrations.libs.handler_helpers import define_ml_handler
from mindsdb.integrations.libs.base import BaseMLEngine
from mindsdb.utilities.log import log
from mindsdb.utilities.log import get_log


log = get_log()


class MLClient(BaseClient):
Expand Down
5 changes: 4 additions & 1 deletion mindsdb/integrations/handlers_wrapper/ml_handler_service.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
import json
from mindsdb.utilities.log import log
from mindsdb.utilities.log import get_log
from mindsdb.integrations.handlers_wrapper.ml_handler_wrapper import MLHandlerWrapper


log = get_log()


if __name__ == "__main__":
params = os.environ.get('PARAMS', '{}')
kwargs = json.loads(params)
Expand Down
4 changes: 3 additions & 1 deletion mindsdb/integrations/handlers_wrapper/ml_handler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
from mindsdb.interfaces.storage.fs import ModelStorage, HandlerStorage

from mindsdb.integrations.libs.handler_helpers import define_ml_handler
from mindsdb.utilities.log import log
from mindsdb.utilities.log import get_log

log = get_log()

class BaseMLWrapper:
"""Base abstract class contains some general methods."""
Expand Down