Skip to content

Commit 32fb4ab

Browse files
Merge pull request #23 from griddb/ts-function
Add timeseries-specific function
2 parents 4f9c394 + a47a44a commit 32fb4ab

16 files changed

+1138
-815
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ ${SOURCE_HEADER}/RowSet.cpp
4343
${SOURCE_HEADER}/TimestampUtils.cpp
4444
${SOURCE_HEADER}/Field.cpp
4545
${SOURCE_HEADER}/RowList.cpp
46-
${SOURCE_HEADER}/RowSet.cpp
4746
${SOURCE_HEADER}/Util.cpp)
4847

4948
target_link_libraries(griddb_python gridstore_c)

Makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ CXX = g++
33

44
ARCH = $(shell arch)
55

6-
LDFLAGS = -Llibs -lpthread -lrt -lgridstore
6+
UNAME_S := $(shell uname -s)
7+
ifeq ($(UNAME_S), Linux)
8+
LDFLAGS = -Llibs -lpthread -lrt -lgridstore
9+
endif
10+
ifeq ($(UNAME_S), Darwin)
11+
LDFLAGS = -lpthread -lgridstore -undefined dynamic_lookup
12+
endif
713

814
CPPFLAGS = -fPIC -std=c++0x -g -O2
915
INCLUDES = -Iinclude -Isrc
16+
PY_CFLAGS := $(shell python3-config --includes)
17+
NUMPY_FLAGS := $(shell python3 -c "import site; print(site.getsitepackages()[0])")
1018

1119
INCLUDES_PYTHON = $(INCLUDES) \
12-
-I/usr/include/python3.9/ \
13-
-I$(HOME)/.pyenv/versions/3.9.5/lib/python3.9/site-packages/numpy/core/include
20+
${PY_CFLAGS} \
21+
-I${NUMPY_FLAGS}/numpy/core/include
1422

1523
PROGRAM = _griddb_python.so
1624
EXTRA = griddb_python.py griddb_python.pyc

README.md

+23-36
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ GridDB Python Client is developed using GridDB C Client and [SWIG](http://www.sw
88

99
Building of the library and execution of the sample programs have been checked in the following environment.
1010

11-
OS: CentOS 7.6(x64) (GCC 4.8.5)
11+
OS: CentOS 7.9(x64) (GCC 4.8.5)
1212
SWIG: 4.0.2
13-
Python: 3.9
14-
GridDB C client: V4.5 CE(Community Edition)
15-
GridDB server: V4.5 CE, CentOS 7.6(x64) (GCC 4.8.5)
13+
Python: 3.10
14+
GridDB C client: V4.6 CE(Community Edition)
15+
GridDB server: V4.6 CE, CentOS 7.9(x64) (GCC 4.8.5)
1616

17-
OS: Ubuntu 18.04(x64) (gcc 7.3.0)
17+
OS: Ubuntu 18.04/20.04(x64) (gcc 7.5.0)
1818
SWIG: 4.0.2
19-
Python: 3.9
20-
GridDB C client: V4.5 CE (Note: If you build from source code, please use GCC 4.8.5.)
21-
GridDB server: V4.5 CE, Ubuntu 18.04(x64) (Note: If you build from source code, please use GCC 4.8.5.)
19+
Python: 3.10
20+
GridDB C client: V4.6 CE (Note: If you build from source code, please use GCC 4.8.5.)
21+
GridDB server: V4.6 CE, Ubuntu 18.04(x64) (Note: If you build from source code, please use GCC 4.8.5.)
2222

2323
OS: Windows 10(x64) (VS2017)
2424
SWIG: 4.0.2
25-
Python: 3.9
26-
GridDB C client: V4.5 CE
27-
GridDB server: V4.5 CE, CentOS 7.6(x64) (GCC 4.8.5)
25+
Python: 3.10
26+
GridDB C client: V4.6 CE
27+
GridDB server: V4.6 CE, CentOS 7.9(x64) (GCC 4.8.5)
2828

2929
OS: MacOS Catalina (x86_64)
3030
SWIG: 4.0.2
31-
Python: 3.9
32-
GridDB C client: V4.5 CE
33-
GridDB server: V4.5 CE, Centos 7.6(x64) (GCC 4.8.5)
31+
Python: 3.10
32+
GridDB C client: V4.6 CE
33+
GridDB server: V4.6 CE, Centos 7.9(x64) (GCC 4.8.5)
3434

3535
## QuickStart (CentOS, Ubuntu)
3636
### Preparations
@@ -58,8 +58,8 @@ Set CPATH and LIBRARY_PATH.
5858

5959
Install Pandas and Numpy as below:
6060

61-
$ python -m pip install numpy
62-
$ python -m pip install pandas
61+
$ python3 -m pip install numpy
62+
$ python3 -m pip install pandas
6363

6464
### Build and Run
6565

@@ -79,11 +79,11 @@ GridDB Server need to be started in advance.
7979

8080
1. Set LD_LIBRARY_PATH
8181

82-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<C client library file directory path>
82+
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<C client library file directory path>
8383

8484
2. The command to run sample
8585

86-
$ sample/sample1.py <GridDB notification address> <GridDB notification port>
86+
$ python3 sample/sample1.py <GridDB notification address> <GridDB notification port>
8787
<GridDB cluster name> <GridDB user> <GridDB password>
8888
-->Person: name=name02 status=False count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]
8989

@@ -124,7 +124,7 @@ Install SWIG as below.
124124
$ sudo make install
125125
126126
Note: If MacOS, you might need to install pcre in advance.
127-
$ sudo brew install pcre
127+
$ brew install pcre
128128
129129
Install [GridDB Server](https://github.com/griddb/griddb) and [C Client](https://github.com/griddb/c_client). (Note: If you build them from source code, please use clang 11.0.0)
130130
@@ -136,22 +136,9 @@ Set CPATH and LIBRARY_PATH.
136136
137137
Install Pandas and Numpy as below:
138138
139-
$ python -m pip install numpy
140-
$ python -m pip install pandas
139+
$ python3 -m pip install numpy
140+
$ python3 -m pip install pandas
141141
142-
Modify **Makefile** to make python_client compatible with MacOS:
143-
- Change python include path and numpy include path on MacOS. For example:
144-
```bash
145-
INCLUDES_PYTHON = $(INCLUDES) \
146-
-I$(HOME)/.pyenv/versions/3.9.5/include/python3.9 \
147-
-I$(HOME)/.pyenv/versions/3.9.5/lib/python3.9/site-packages/numpy/core/include
148-
```
149-
150-
- Remove "-Llibs -lrt" (not support on MacOS) from LDFLAGS on Makefile
151-
- Add "-undefined dynamic_lookup" like
152-
```bash
153-
$(CXX) -shared -undefined dynamic_lookup -o $@ $(OBJS) $(SWIG_PYTHON_OBJS) $(LDFLAGS)
154-
```
155142
### Build and Run
156143
157144
1. Execute the command on project directory.
@@ -186,12 +173,12 @@ GridDB Server need to be started in advance.
186173
- normal query, aggregation with TQL
187174
- Multi-Put/Get/Query (batch processing)
188175
- Array type for GridDB
176+
- timeseries-specific function, affinity
189177
190178
(not available)
191179
- GEOMETRY type for GridDB
192180
- timeseries compression
193-
- timeseries-specific function like gsAggregateTimeSeries, gsQueryByTimeSeriesSampling in C client
194-
- trigger, affinity
181+
- trigger
195182
196183
Please refer to the following files for more detailed information.
197184
- [Python Client API Reference](https://griddb.github.io/python_client/PythonAPIReference.htm)

docs/PythonAPIReference.files/sheet001.htm

+30-30
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns="http://www.w3.org/TR/REC-html40">
55

66
<head>
7-
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
7+
<meta http-equiv=Content-Type content="text/html; charset=shift_jis">
88
<meta name=ProgId content=Excel.Sheet>
99
<meta name=Generator content="Microsoft Excel 15">
1010
<link id=Main-File rel=Main-File href="../PythonAPIReference.htm">
@@ -26,7 +26,7 @@
2626
font-weight:400;
2727
font-style:normal;
2828
text-decoration:none;
29-
font-family:"MS Pゴシック", monospace;
29+
font-family:"‚l‚r ‚oƒSƒVƒbƒN", monospace;
3030
mso-font-charset:128;
3131
mso-char-type:katakana;
3232
display:none;}
@@ -61,74 +61,74 @@
6161
<col width=229 style='mso-width-source:userset;mso-width-alt:7328;width:172pt'>
6262
<col width=554 style='mso-width-source:userset;mso-width-alt:17728;width:416pt'>
6363
<tr height=18 style='height:13.5pt'>
64-
<td height=18 class=xl66 width=229 style='height:13.5pt;width:172pt'>class</td>
65-
<td class=xl74 width=554 style='border-left:none;width:416pt'>description</td>
64+
<td height=18 class=xl67 width=229 style='height:13.5pt;width:172pt'>class</td>
65+
<td class=xl75 width=554 style='border-left:none;width:416pt'>description</td>
6666
</tr>
6767
<tr height=18 style='height:13.5pt'>
68-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>AggregationResult</td>
69-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Stores
68+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>AggregationResult</td>
69+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Stores
7070
the result of an aggregation operation</td>
7171
</tr>
7272
<tr height=18 style='height:13.5pt'>
73-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>Container</td>
74-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
73+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>Container</td>
74+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
7575
management functions for sets of row having same type</td>
7676
</tr>
7777
<tr height=36 style='height:27.0pt'>
78-
<td height=36 class=xl68 style='height:27.0pt;border-top:none'>QueryAnalysisEntry</td>
79-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
78+
<td height=36 class=xl69 style='height:27.0pt;border-top:none'>QueryAnalysisEntry</td>
79+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
8080
one of information entries composing a query plan and the results of
8181
analyzing a query operation.</td>
8282
</tr>
8383
<tr height=18 style='height:13.5pt'>
84-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>GSException</td>
85-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
84+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>GSException</td>
85+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
8686
the exception for GridDB</td>
8787
</tr>
8888
<tr height=18 style='height:13.5pt'>
89-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>PartitionController</td>
90-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Controller
89+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>PartitionController</td>
90+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Controller
9191
for acquiring and processing the partition status</td>
9292
</tr>
9393
<tr height=36 style='height:27.0pt'>
94-
<td height=36 class=xl68 style='height:27.0pt;border-top:none'>Query</td>
95-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
94+
<td height=36 class=xl69 style='height:27.0pt;border-top:none'>Query</td>
95+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
9696
the functions of holding the information about a query related to a specific
9797
Container, specifying the options for fetching and retrieving the result</td>
9898
</tr>
9999
<tr height=18 style='height:13.5pt'>
100-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>RowKeyPredicate</td>
101-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
100+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>RowKeyPredicate</td>
101+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
102102
the condition that a row key satisfies</td>
103103
</tr>
104104
<tr height=18 style='height:13.5pt'>
105-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>RowSet</td>
106-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Manages
105+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>RowSet</td>
106+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Manages
107107
a set of Rows obtained by a query</td>
108108
</tr>
109109
<tr height=18 style='height:13.5pt'>
110-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>Store</td>
111-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
110+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>Store</td>
111+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
112112
functions to manipulate the entire data managed in one GridDB system</td>
113113
</tr>
114114
<tr height=18 style='height:13.5pt'>
115-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>StoreFactory</td>
116-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Manages
115+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>StoreFactory</td>
116+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Manages
117117
a Store instance</td>
118118
</tr>
119119
<tr height=18 style='height:13.5pt'>
120-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>ContainerInfo</td>
121-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
120+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>ContainerInfo</td>
121+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
122122
the information about a Container</td>
123123
</tr>
124124
<tr height=18 style='height:13.5pt'>
125-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>ExpirationInfo</td>
126-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
125+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>ExpirationInfo</td>
126+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Represents
127127
the information about a expiration</td>
128128
</tr>
129129
<tr height=18 style='height:13.5pt'>
130-
<td height=18 class=xl68 style='height:13.5pt;border-top:none'>TimestampUtils</td>
131-
<td class=xl72 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
130+
<td height=18 class=xl69 style='height:13.5pt;border-top:none'>TimestampUtils</td>
131+
<td class=xl73 width=554 style='border-top:none;border-left:none;width:416pt'>Provides
132132
the utilities for manipulating time data</td>
133133
</tr>
134134
<![if supportMisalignedColumns]>

0 commit comments

Comments
 (0)