You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please refer to [Contribution Guideline](https://github.com/4paradigm/OpenMLDB/blob/main/CONTRIBUTING.md)
3
3
4
+
## Pull Request (PR) Guidelines
5
+
6
+
When submitting a PR, please pay attention to the following points:
7
+
- PR Title: Please adhere to the [commit format](https://github.com/4paradigm/rfcs/blob/main/style-guide/commit-convention.md#conventional-commits-reference) for the PR title. **Note that this refers to the PR title, not the commits within the PR**.
8
+
```{note}
9
+
If the title does not meet the standard, `pr-linter / pr-name-lint (pull_request)` will fail with a status of `x`.
10
+
```
11
+
- PR Checks: There are various checks in a PR, and only `codecov/patch` and `codecov/project` may not pass. Other checks should pass. If other checks do not pass and you cannot fix them or believe they should not be fixed, you can leave a comment in the PR.
12
+
13
+
- PR Description: Please explain the intent of the PR in the first comment of the PR. We provide a PR comment template, and while you are not required to follow it, ensure that there is sufficient explanation.
14
+
15
+
- PR Files Changed: Pay attention to the `files changed` in the PR. Do not include code changes outside the scope of the PR intent. You can generally eliminate unnecessary diffs by using `git merge origin/main` followed by `git push` to the PR branch. If you need assistance, leave a comment in the PR.
16
+
```{note}
17
+
If you are not modifying the code based on the main branch, when the PR intends to merge into the main branch, the `files changed` will include unnecessary code. For example, if the main branch is at commit 10, and you start from commit 9 of the old main, add new_commit1, and then add new_commit2 on top of new_commit1, you actually only want to submit new_commit2, but the PR will include new_commit1 and new_commit2.
18
+
In this case, just use `git merge origin/main` and `git push` to the PR branch to only include the changes.
19
+
```
20
+
```{seealso}
21
+
If you want the branch code to be cleaner, you can avoid using `git merge` and use `git rebase -i origin/main` instead. It will add your changes one by one on top of the main branch. However, it will change the commit history, and you need `git push -f` to override the branch.
22
+
```
23
+
24
+
## Compilation Guidelines
25
+
26
+
For compilation details, refer to the [Compilation Documentation](../deploy/compile.md). To avoid the impact of operating systems and tool versions, we recommend compiling OpenMLDB in a compilation image. Since compiling the entire OpenMLDB requires significant space, we recommend using `OPENMLDB_BUILD_TARGET` to specify only the parts you need.
Copy file name to clipboardExpand all lines: docs/en/developer/python_dev.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,19 @@
2
2
3
3
There are two modules in `python/`: Python SDK and an OpenMLDB diagnostic tool.
4
4
5
-
## SDK Testing Methods
5
+
## SDK
6
+
7
+
The Python SDK itself does not depend on the pytest and tox libraries used for testing. If you want to use the tests in the tests directory for testing, you can download the testing dependencies using the following method.
8
+
9
+
```
10
+
pip install 'openmldb[test]'
11
+
pip install 'dist/....whl[test]'
12
+
```
13
+
14
+
### Testing Method
15
+
16
+
Run the command `make SQL_PYSDK_ENABLE=ON OPENMLDB_BUILD_TARGET=cp_python_sdk_so` under the root directory and make sure the library in `python/openmldb_sdk/openmldb/native/` was the latest native library. Testing typically requires connecting to an OpenMLDB cluster. If you haven't started a cluster yet, or if you've made code changes to the service components, you'll also need to compile the TARGET openmldb and start a onebox cluster. You can refer to the launch section of `steps/test_python.sh` for guidance.
6
17
7
-
Run the command `make SQL_PYSDK_ENABLE=ON OPENMLDB_BUILD_TARGET=cp_python_sdk_so` under the root directory and make sure the library in `python/openmldb_sdk/openmldb/native/` was the latest native library.
8
18
1. Package installation test: Install the compiled `whl`, then run `pytest tests/`. You can use the script `steps/test_python.sh` directly.
9
19
2. Dynamic test: Make sure there isn't OpenMLDB in `pip` or the compiled `whl`. Run `pytest test/` in `python/openmldb_sdk`, thereby you can easily debug.
10
20
@@ -32,6 +42,11 @@ If the python log messages are required in all tests(even successful tests), ple
You can also use the module mode for running tests, which is suitable for actual runtime testing.
46
+
```
47
+
python -m diagnostic_tool.diagnose ...
48
+
```
49
+
35
50
## Conda
36
51
37
52
If you use conda, `pytest` may found the wrong python, then get errors like `ModuleNotFoundError: No module named 'IPython'`. Please use `python -m pytest`.
Copy file name to clipboardExpand all lines: docs/en/developer/sdk_develop.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,22 +9,19 @@ The OpenMLDB SDK can be divided into several layers, as shown in the figure. The
9
9
The bottom layer is the SDK core layer, which is implemented as [SQLClusterRouter](https://github.com/4paradigm/OpenMLDB/blob/b6f122798f567adf2bb7766e2c3b81b633ebd231/src/sdk/sql_cluster_router.h#L110). It is the core layer of **client**. All operations on OpenMLDB clusters can be done by using the methods of `SQLClusterRouter` after proper configuration.
10
10
11
11
Three core methods of this layer that developers may need to use are:
12
-
13
12
1.[ExecuteSQL](https://github.com/4paradigm/OpenMLDB/blob/b6f122798f567adf2bb7766e2c3b81b633ebd231/src/sdk/sql_cluster_router.h#L160) supports the execution of all SQL commands, including DDL, DML and DQL.
3.[ExecuteSQLRequest](https://github.com/4paradigm/OpenMLDB/blob/b6f122798f567adf2bb7766e2c3b81b633ebd231/src/sdk/sql_cluster_router.h#L156)is the special methods for the OpenMLDB specific execution mode: [Online Request mode](../tutorial/modes.md#4-the-online-request-mode).
16
15
17
-
16
+
Other methods, such as CreateDB, DropDB, DropTable, have not been removed promptly due to historical reasons. Developers don't need to be concerned about them.
18
17
19
18
### Wrapper Layer
20
-
Due to the complexity of the implementation of the SDK Layer, we didn't develop the Java and Python SDKs from scratch, but to use Java and Python to call the **SDK Layer**. Specifically, we made a wrapper layer using Swig.
19
+
Due to the complexity of the implementation of the SDK Layer, we didn't develop the Java and Python SDKs from scratch, but to use Java and Python to call the **SDK Layer**. Specifically, we made a wrapper layer using swig.
21
20
22
21
Java Wrapper is implemented as [SqlClusterExecutor](https://github.com/4paradigm/OpenMLDB/blob/main/java/openmldb-jdbc/src/main/java/com/_4paradigm/openmldb/sdk/impl/SqlClusterExecutor.java). It is a simple wrapper of `sql_router_sdk`, including the conversion of input types, the encapsulation of returned results, the encapsulation of returned errors.
23
22
24
23
Python Wrapper is implemented as [OpenMLDBSdk](https://github.com/4paradigm/OpenMLDB/blob/main/python/openmldb/sdk/sdk.py). Like the Java Wrapper, it is a simple wrapper as well.
25
24
26
-
27
-
28
25
### User Layer
29
26
Although the Wrapper Layer can be used directly, it is not convenient enough. So, we develop another layer, the User Layer of the Java/Python SDK.
30
27
@@ -36,7 +33,8 @@ The Python User Layer supports the `sqlalchemy`. See [sqlalchemy_openmldb](https
36
33
37
34
We want an easier to use C++ SDK which doesn't need a Wrapper Layer.
38
35
Therefore, in theory, developers only need to design and implement the user layer, which calls the SDK layer.
39
-
However, in consideration of code reuse, the SDK Layer code may be changed to some extent, or the core SDK code structure may be adjusted (for example, exposing part of the SDK Layer header file, etc.).
36
+
37
+
However, in consideration of code reuse, the SDK Layer code may be changed to some extent, or the core SDK code structure may be adjusted (for example, exposing part of the SDK Layer header file, etc.).
40
38
41
39
## Details of SDK Layer
42
40
@@ -48,7 +46,6 @@ The first two methods are using two options, which create a server connecting Cl
48
46
```
49
47
These two methods, which do not expose the metadata related DBSDK, are suitable for ordinary users. The underlayers of Java and Python SDK also use these two approaches.
50
48
51
-
52
49
Another way is to create based on DBSDK:
53
50
```
54
51
explicit SQLClusterRouter(DBSDK* sdk);
@@ -85,4 +82,18 @@ If you only want to run JAVA testing, try the commands below:
85
82
```
86
83
mvn test -pl openmldb-jdbc -Dtest="SQLRouterSmokeTest"
87
84
mvn test -pl openmldb-jdbc -Dtest="SQLRouterSmokeTest#AnyMethod"
88
-
```
85
+
```
86
+
87
+
### batchjob test
88
+
89
+
batchjob tests can be done using the following method:
Alternatively, you can copy the compiled openmldb-batchjob JAR file to the `lib` directory of the task manager in the OpenMLDB cluster. Then, you can use the client or Taskmanager Client to send commands for testing.
95
+
96
+
When using Hive as a data source, make sure the metastore service is available. For local testing, you can start the metastore service in the Hive directory with the default address being `thrift://localhost:9083`.
0 commit comments