Skip to content

Commit df9a9f1

Browse files
authored
Merge pull request #87 from mindsdb/staging
Release 2.1.0
2 parents 4c89228 + 67f1983 commit df9a9f1

24 files changed

+454
-182
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Add Pull Requests to PR review project
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
8+
jobs:
9+
add-to-project:
10+
name: Add issue to project
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/add-to-project@v0.5.0
14+
with:
15+
project-url: https://github.com/orgs/mindsdb/projects/65
16+
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Add issue to roadmap project
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
jobs:
7+
add-to-project:
8+
name: Add issue to roadmap project
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/add-to-project@v0.4.0
12+
with:
13+
project-url: https://github.com/orgs/mindsdb/projects/53
14+
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}

.github/workflows/mindsdb_python_sdk.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
name: MindsDB Native workflow
1+
name: PR workflow
22

33
on:
4-
push:
54
pull_request:
65
branches:
76
- stable
@@ -43,6 +42,8 @@ jobs:
4342
needs: test
4443
if: github.ref != 'refs/heads/stable'
4544
runs-on: ubuntu-latest
45+
permissions:
46+
pull-requests: write
4647
steps:
4748
- uses: actions/checkout@v3
4849
- name: Set up Python 3.8
@@ -65,25 +66,3 @@ jobs:
6566
with:
6667
pytest-coverage-path: ./pytest-coverage.txt
6768
junitxml-path: ./pytest.xml
68-
69-
deploy:
70-
runs-on: ubuntu-latest
71-
needs: test
72-
if: github.ref == 'refs/heads/stable'
73-
steps:
74-
- uses: actions/checkout@v2
75-
- name: Set up Python
76-
uses: actions/setup-python@v2
77-
with:
78-
python-version: '3.7'
79-
- name: Install dependencies
80-
run: |
81-
python -m pip install --upgrade pip==20.2.4
82-
pip install setuptools wheel twine
83-
- name: Build and publish
84-
env:
85-
TWINE_USERNAME: __token__
86-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
87-
run: |
88-
python setup.py sdist
89-
twine upload dist/*

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- stable
7+
8+
jobs:
9+
test:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest]
14+
python-version: [3.7,3.8,3.9]
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip==22.0.4
24+
pip install -r requirements.txt
25+
pip install --no-cache-dir .
26+
- name: Run tests
27+
run: |
28+
if [ "$RUNNER_OS" == "Linux" ]; then
29+
30+
env PYTHONPATH=./ pytest tests/
31+
32+
fi
33+
shell: bash
34+
env:
35+
CHECK_FOR_UPDATES: False
36+
DATABASE_CREDENTIALS_STRINGIFIED_JSON: ${{ secrets.DATABASE_CREDENTIALS }}
37+
CLOUD_TEST_EMAIL: ${{ secrets.CLOUD_TEST_EMAIL }}
38+
CLOUD_TEST_PASSWORD: ${{ secrets.CLOUD_TEST_PASSWORD }}
39+
40+
41+
deploy:
42+
runs-on: ubuntu-latest
43+
needs: test
44+
if: github.ref == 'refs/heads/stable'
45+
steps:
46+
- uses: actions/checkout@v2
47+
- name: Set up Python
48+
uses: actions/setup-python@v2
49+
with:
50+
python-version: '3.7'
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --upgrade pip==20.2.4
54+
pip install setuptools wheel twine
55+
- name: Build and publish
56+
env:
57+
TWINE_USERNAME: __token__
58+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
59+
run: |
60+
python setup.py sdist
61+
twine upload dist/*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ https://github.com/mindsdb/mindsdb_python_sdk/tree/staging/examples
107107

108108
## API Documentation
109109

110-
The API documentation for the MindsDB SDK can be found at https://mindsdb.github.io/mindsdb_python_sdk/. You can generate the API documentation locally by following these steps:
110+
The API documentation for the MindsDB SDK can be found at https://mindsdb.github.io/mindsdb_python_sdk/.
111111

112112
### Generating API docs locally:
113113

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>`

examples/working_with_tables.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,44 @@
33

44
con = mindsdb_sdk.connect()
55

6-
# get user's database (connected to mindsdb as rental_db)
7-
db = con.databases.rental_db
6+
# connect to mindsdb example database
7+
example_db = con.databases.create(
8+
'example_db',
9+
engine='postgres',
10+
connection_args={
11+
"user": "demo_user",
12+
"password": "demo_password",
13+
"host": "3.220.66.106",
14+
"port": "5432",
15+
"database": "demo"
16+
}
17+
)
818

9-
# get table
10-
table1 = db.tables.house_sales
19+
# connect to the empty user database
20+
my_db = con.databases.create(
21+
'my_db',
22+
engine='postgres',
23+
connection_args={
24+
"user": "postgres",
25+
"host": "localhost",
26+
"port": "5432",
27+
"database": "my_database"
28+
}
29+
)
1130

31+
# get home_rentals table
32+
table1 = example_db.tables.get('demo_data.home_rentals')
1233

1334
# ---- create new table ----
1435

15-
# copy create table house_sales and fill it with rows with type=house
16-
table2 = db.tables.create('house_sales2', table1.filter(type='house'))
36+
# create table home_rentals in user db and fill it with rows with location=great
37+
table2 = my_db.tables.create('home_rentals', table1.filter(location='great'))
38+
1739

1840
# create table from csv file
41+
1942
df = pd.read_csv('my_data.csv')
20-
table3 = db.tables.create('my_table', df)
43+
table3 = my_db.tables.create('my_table', df)
2144

2245

2346
# ---- insert into table ----
@@ -28,16 +51,16 @@
2851

2952
# ---- update data in table ----
3053

31-
# get all rows with type=house from table1 and update values in table2 using key ('saledate', 'type', 'bedrooms')
54+
# get all rows with number_of_rooms=1 from table1 and update values in table2 using key ('location', 'neighborhood')
3255
table2.update(
33-
table1.filter(type='house'),
34-
on=['saledate', 'type', 'bedrooms']
56+
table1.filter(number_of_rooms=1),
57+
on=['location', 'neighborhood']
3558
)
3659

3760

3861
# ---- delete rows from table ----
3962

4063
# delete all rows where bedrooms=2
41-
table2.delete(bedrooms=2)
64+
table2.delete(number_of_rooms=1)
4265

4366

0 commit comments

Comments
 (0)