Skip to content

Commit 317c49b

Browse files
committed
update of docs
1 parent b1cb05d commit 317c49b

File tree

12 files changed

+119
-58
lines changed

12 files changed

+119
-58
lines changed

docs/source/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
# -- General configuration ---------------------------------------------------
1717
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1818

19-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon']
19+
extensions = [
20+
'sphinx.ext.autodoc',
21+
'sphinx.ext.napoleon',
22+
'sphinx.ext.autosectionlabel'
23+
]
2024

2125
templates_path = ['_templates']
2226
exclude_patterns = []

docs/source/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Base usage
9090
More
9191
9292
More examples
93-
-----------
93+
-------------
9494

9595
`<https://github.com/mindsdb/mindsdb_python_sdk/examples>`_
9696

@@ -107,12 +107,13 @@ API documentation
107107
:maxdepth: 1
108108
:caption: Modules:
109109

110-
111110
server
112111
database
112+
113+
project
113114
handlers
115+
114116
ml_engines
115-
project
116117
model
117118
tables
118119
views

docs/source/jobs.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Jobs
22
-------------------------
33

4+
.. _my-reference-label:
5+
6+
47
.. automodule:: mindsdb_sdk.jobs
58
:members:
69
:undoc-members:

docs/source/server.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ Server
44
.. automodule:: mindsdb_sdk.server
55
:members:
66
:undoc-members:
7-
:show-inheritance:
7+
:show-inheritance:
8+
9+
10+
:ref:`jobs<Jobs>`

mindsdb_sdk/connect.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ def connect(url: str = None, login: str = None, password: str = None, is_managed
2020
2121
Connect to local server
2222
23-
>>> server = mindsdb_sdk.connect()
24-
>>> server = mindsdb_sdk.connect('http://127.0.0.1:47334')
23+
>>> con = mindsdb_sdk.connect()
24+
>>> con = mindsdb_sdk.connect('http://127.0.0.1:47334')
2525
2626
Connect to cloud server
2727
28-
>>> server = mindsdb_sdk.connect(login='a@b.com', password='-')
29-
>>> server = mindsdb_sdk.connect('https://cloud.mindsdb.com', login='a@b.com', password='-')
28+
>>> con = mindsdb_sdk.connect(login='a@b.com', password='-')
29+
>>> con = mindsdb_sdk.connect('https://cloud.mindsdb.com', login='a@b.com', password='-')
3030
3131
Connect to MindsDB pro
3232
33-
>>> server = mindsdb_sdk.connect('http://<YOUR_INSTANCE_IP>', login='a@b.com', password='-', is_managed=True)
33+
>>> con = mindsdb_sdk.connect('http://<YOUR_INSTANCE_IP>', login='a@b.com', password='-', is_managed=True)
3434
3535
"""
3636
if url is None:

mindsdb_sdk/handlers.py

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
@dataclass(init=False)
1111
class Handler:
12+
"""
13+
:meta private:
14+
"""
1215
name: str
1316
title: str
1417
version: str
@@ -26,26 +29,7 @@ def __init__(self, **kwargs):
2629

2730
class Handlers(CollectionBase):
2831
"""
29-
**Handlers colection**
30-
31-
Examples of usage:
32-
33-
ML handlers:
34-
35-
Get list
36-
>>> con.ml_handlers.list()
37-
38-
Get
39-
>>> openai_handler = con.ml_handlers.openai
40-
41-
DATA handlers:
42-
43-
Get list
44-
>>> con.data_handlers.list()
45-
46-
Get
47-
>>> pg_handler = con.data_handlers.postgres
48-
32+
:meta private:
4933
"""
5034

5135
def __init__(self, api, type):
@@ -91,3 +75,43 @@ def get(self, name: str) -> Handler:
9175
if item.name == name:
9276
return item
9377
raise AttributeError(f"Handler doesn't exist: {name}")
78+
79+
80+
class MLHandlers(Handlers):
81+
"""
82+
**ML handlers colection**
83+
84+
Examples of usage:
85+
86+
Get list
87+
88+
>>> con.ml_handlers.list()
89+
90+
Get
91+
92+
>>> openai_handler = con.ml_handlers.openai
93+
>>> openai_handler = con.ml_handlers.get('openai')
94+
95+
"""
96+
97+
...
98+
99+
100+
class DataHandlers(Handlers):
101+
"""
102+
**DATA handlers colection**
103+
104+
Examples of usage:
105+
106+
Get list
107+
108+
>>> con.data_handlers.list()
109+
110+
Get
111+
112+
>>> pg_handler = con.data_handlers.postgres
113+
>>> pg_handler = con.data_handlers.get('postgres')
114+
115+
"""
116+
117+
...

mindsdb_sdk/jobs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ def create(self, name: str, query_str: str,
9999
repeat_str: str = None) -> Union[Job, None]:
100100
"""
101101
Create new job in project and return it.
102-
If it is not possible (job executed and not accessible anymore): return None
102+
103+
If it is not possible (job executed and not accessible anymore):
104+
return None
105+
103106
More info: https://docs.mindsdb.com/sql/create/jobs
104107
105108
:param name: name of the job

mindsdb_sdk/ml_engines.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
@dataclass
1212
class MLEngine:
13+
"""
14+
:meta private:
15+
"""
1316
name: str
1417
handler: str
1518
connection_data: dict
@@ -23,19 +26,23 @@ class MLEngines(CollectionBase):
2326
Examples of usage:
2427
2528
Get list
29+
2630
>>> ml_engines = con.ml_engines.list()
2731
2832
Get
33+
2934
>>> openai_engine = con.ml_engines.openai1
3035
3136
Create
37+
3238
>>> con.ml_engines.create(
3339
... 'openai1',
3440
... 'openai',
3541
... connection_data={'api_key': '111'}
3642
...)
3743
3844
Drop
45+
3946
>>> con.ml_engines.drop('openai1')
4047
4148
"""
@@ -46,6 +53,7 @@ def __init__(self, api):
4653
def list(self) -> List[MLEngine]:
4754
"""
4855
Returns list of ml engines on server
56+
4957
:return: list of ml engines
5058
"""
5159

@@ -77,6 +85,7 @@ def get(self, name: str) -> MLEngine:
7785
def create(self, name: str, handler: Union[str, Handler], connection_data: dict = None) -> MLEngine:
7886
"""
7987
Create new ml engine and return it
88+
8089
:param name: ml engine name, string
8190
:param handler: handler name, string or Handler
8291
:param connection_data: parameters for ml engine, dict, optional
@@ -95,6 +104,7 @@ def create(self, name: str, handler: Union[str, Handler], connection_data: dict
95104
def drop(self, name: str):
96105
"""
97106
Drop ml engine by name
107+
98108
:param name: name
99109
"""
100110
ast_query = DropMLEngine(Identifier(name))

mindsdb_sdk/models.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ def predict(self, data: Union[pd.DataFrame, Query, dict], params: dict = None) -
117117
"""
118118
Make prediction using model
119119
120-
if data is dataframe it uses /model/predict http method and sends dataframe over it
121-
if data is select query with one table it replaces table to jon table and predictor
122-
and sends query over sql/query http method
120+
if data is dataframe
121+
it uses /model/predict http method and sends dataframe over it
122+
123+
if data is select query with one table
124+
it replaces table to jon table and predictor and sends query over sql/query http method
123125
124126
if data is select from join other complex query it modifies query to:
125127
'select from (input query) join model' and sends it over sql/query http method
@@ -549,8 +551,10 @@ def list(self, with_versions: bool = False,
549551
"""
550552
List models (or model versions) in project
551553
552-
If with_versions = True it shows all models with version (executes 'select * from models_versions')
553-
Otherwise it shows only models (executes 'select * from models')
554+
If with_versions = True
555+
it shows all models with version (executes 'select * from models_versions')
556+
557+
Otherwise it shows only models (executes 'select * from models')
554558
555559
:param with_versions: show model versions
556560
:param name: to show models or versions only with selected name, optional

mindsdb_sdk/projects.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class Project:
2121
Server instance allows to manipulate project and databases (integration) on mindsdb server
2222
2323
Attributes for accessing to different objects:
24-
- models
25-
- views
26-
- jobs
24+
- models, see :func:`~mindsdb_sdk.models.Models`
25+
- views, see :func:`~mindsdb_sdk.views.Views`
26+
- jobs, see :func:`~mindsdb_sdk.jobs.Jobs`
2727
2828
It is possible to cal queries from project context:
2929
@@ -109,23 +109,23 @@ class Projects(CollectionBase):
109109
Projects
110110
----------
111111
112-
# list of projects
112+
list of projects
113113
114114
>>> projects.list()
115115
116-
# create
116+
create
117117
118118
>>> project = projects.create('proj')
119119
120-
# drop
120+
drop
121121
122122
>>> projects.drop('proj')
123123
124-
# get existing
124+
get existing
125125
126126
>>> projects.get('proj')
127127
128-
# by attribute
128+
by attribute
129129
>>> projects.proj
130130
131131
"""

0 commit comments

Comments
 (0)