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

feat: add support for standalone mode in Python SDK #1325

Merged
merged 18 commits into from
Mar 3, 2022
Merged

feat: add support for standalone mode in Python SDK #1325

merged 18 commits into from
Mar 3, 2022

Conversation

HuilinWu2
Copy link
Collaborator

@HuilinWu2 HuilinWu2 commented Feb 25, 2022

now users are able to use standalone mode in python SDK DBAPI through:

import openmldb
# cluster mode
db = openmldb.dbapi.connect("db_test","127.0.0.1:6181","/onebox")

# standalone mode
db = openmldb.dbapi.connect("db_test","127.0.0.1", 6527)

or through sqlalchemy API:

import sqlalchemy as db
# cluster
engine = db.create_engine("openmldb:///db_test?zk=127.0.0.1:6181&zkPath=/onebox")

# standalone
engine = db.create_engine("openmldb:///db_test?host=127.0.0.1&port=6527")

@HuilinWu2 HuilinWu2 added the enhancement New feature or request label Feb 25, 2022
@HuilinWu2 HuilinWu2 linked an issue Feb 25, 2022 that may be closed by this pull request
python/openmldb/dbapi/dbapi.py Outdated Show resolved Hide resolved
python/openmldb/sdk/sdk.py Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2022

Linux Test Report

     110 files       236 suites   43m 33s ⏱️
  8 613 tests   8 610 ✔️ 3 💤 0
12 745 runs  12 742 ✔️ 3 💤 0

Results for commit 6da0ec8.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Feb 25, 2022

Codecov Report

Merging #1325 (5ecb1ad) into main (461d520) will increase coverage by 0.11%.
The diff coverage is n/a.

❗ Current head 5ecb1ad differs from pull request most recent head 6da0ec8. Consider uploading reports for the commit 6da0ec8 to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1325      +/-   ##
============================================
+ Coverage     65.41%   65.53%   +0.11%     
+ Complexity      231      222       -9     
============================================
  Files           570      570              
  Lines        106540   106439     -101     
  Branches        872      857      -15     
============================================
+ Hits          69696    69752      +56     
+ Misses        36692    36541     -151     
+ Partials        152      146       -6     
Impacted Files Coverage Δ
src/base/status.h 60.00% <0.00%> (-40.00%) ⬇️
hybridse/include/base/spin_lock.h 66.66% <0.00%> (-33.34%) ⬇️
hybridse/include/sdk/base.h 14.28% <0.00%> (-4.95%) ⬇️
..._4paradigm/openmldb/batch/nodes/LoadDataPlan.scala 53.68% <0.00%> (-4.81%) ⬇️
..._4paradigm/openmldb/batch/utils/SparkRowUtil.scala 58.53% <0.00%> (-2.44%) ⬇️
src/sdk/sql_cluster_router.cc 32.90% <0.00%> (-1.90%) ⬇️
..._4paradigm/openmldb/batch/utils/HybridseUtil.scala 60.90% <0.00%> (-1.51%) ⬇️
src/catalog/tablet_catalog.cc 67.92% <0.00%> (-0.95%) ⬇️
src/client/ns_client.cc 41.15% <0.00%> (-0.31%) ⬇️
src/sdk/db_sdk.cc 60.60% <0.00%> (-0.31%) ⬇️
... and 36 more

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 aac8167...6da0ec8. Read the comment docs.

@HuilinWu2 HuilinWu2 added this to the v0.5 milestone Mar 2, 2022
Copy link
Collaborator

@tobegit3hub tobegit3hub left a comment

Choose a reason for hiding this comment

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

LGTM

@dl239
Copy link
Collaborator

dl239 commented Mar 2, 2022

now users are able to use standalone mode in python SDK DBAPI through:

import openmldb
# cluster mode
db = openmldb.dbapi.connect("db_test","127.0.0.1:6181","/onebox")

# standalone mode
db = openmldb.dbapi.connect("db_test", host="127.0.0.1", port=6527, is_cluster_mode=False)

or through sqlalchemy API:

import sqlalchemy as db
# cluster
engine = db.create_engine("openmldb:///db_test?zk=127.0.0.1:6181&zkPath=/onebox")

# standalone
engine = db.create_engine("openmldb:///db_test?host=127.0.0.1&port=6527", connect_args={'is_cluster_mode':False})

why add is_cluster_mode option to host and port connect method. It's better to keep consist with CLI that zk as cluster and host/port as standalone

@HuilinWu2
Copy link
Collaborator Author

HuilinWu2 commented Mar 2, 2022

now users are able to use standalone mode in python SDK DBAPI through:

import openmldb
# cluster mode
db = openmldb.dbapi.connect("db_test","127.0.0.1:6181","/onebox")

# standalone mode
db = openmldb.dbapi.connect("db_test", host="127.0.0.1", port=6527, is_cluster_mode=False)

or through sqlalchemy API:

import sqlalchemy as db
# cluster
engine = db.create_engine("openmldb:///db_test?zk=127.0.0.1:6181&zkPath=/onebox")

# standalone
engine = db.create_engine("openmldb:///db_test?host=127.0.0.1&port=6527", connect_args={'is_cluster_mode':False})

why add is_cluster_mode option to host and port connect method. It's better to keep consist with CLI that zk as cluster and host/port as standalone

RE: I agree, we have also considered. However, if so , then we may know whether users want to use standalone/cluster mode only by identifying the type of the second input, namely zkPath string or port int, do you agree?

@tobegit3hub tobegit3hub merged commit f7e172c into 4paradigm:main Mar 3, 2022
@dl239 dl239 mentioned this pull request Mar 30, 2022
dl239 added a commit to dl239/OpenMLDB that referenced this pull request Mar 31, 2022
@lumianph lumianph mentioned this pull request Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support standalone mode in Python SDK
3 participants