pgpack-dumper 0.3.4.7__cp314-cp314-macosx_10_15_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,224 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgpack_dumper
3
+ Version: 0.3.4.7
4
+ Summary: Library for read and write PGPack format between PostgreSQL and file.
5
+ Author-email: 0xMihalich <bayanmobile87@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 0xMihalich
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/0xMihalich/pgpack_dumper
29
+ Project-URL: Documentation, https://github.com/0xMihalich/pgpack_dumper#readme
30
+ Project-URL: Repository, https://github.com/0xMihalich/pgpack_dumper
31
+ Project-URL: Changelog, https://github.com/0xMihalich/pgpack_dumper/blob/main/CHANGELOG.md
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Programming Language :: Python :: 3.13
38
+ Classifier: Programming Language :: Python :: 3.14
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown
41
+ License-File: README.md
42
+ License-File: CHANGELOG.md
43
+ Requires-Dist: pgpack==0.3.2.2
44
+ Requires-Dist: psycopg_binary>=3.3.2
45
+ Requires-Dist: psycopg>=3.3.2
46
+ Requires-Dist: sqlparse>=0.5.4
47
+ Dynamic: license-file
48
+
49
+ # PGPackDumper
50
+
51
+ Library for read and write PGPack format between PostgreSQL and file
52
+
53
+ ## Examples
54
+
55
+ ### Initialization
56
+
57
+ ```python
58
+ from pgpack_dumper import (
59
+ CompressionMethod,
60
+ PGConnector,
61
+ PGPackDumper,
62
+ )
63
+
64
+ connector = PGConnector(
65
+ host = <your host>,
66
+ dbname = <your database>,
67
+ user = <your username>,
68
+ password = <your password>,
69
+ port = <your port>,
70
+ )
71
+
72
+ dumper = PGPackDumper(
73
+ connector=connector,
74
+ compression_method=CompressionMethod.ZSTD, # or CompressionMethod.LZ4 or CompressionMethod.NONE
75
+ )
76
+ ```
77
+
78
+ ### Read dump from PostgreSQL into file
79
+
80
+ ```python
81
+ file_name = "test_table.pgpack"
82
+ # you need define one of parameter query or table_name
83
+ query = "select ..." # some sql query
84
+ table_name = "public.test_table" # or some table
85
+
86
+ with open(file_name, "wb") as fileobj:
87
+ dumper.read_dump(
88
+ fileobj,
89
+ query,
90
+ table_name,
91
+ )
92
+ ```
93
+
94
+ ### Write dump from file into PostgreSQL
95
+
96
+ ```python
97
+ file_name = "test_table.pgpack"
98
+ # you need define one of parameter table_name
99
+ table_name = "public.test_table" # some table
100
+
101
+ with open(file_name, "rb") as fileobj:
102
+ dumper.write_dump(
103
+ fileobj,
104
+ table_name,
105
+ )
106
+ ```
107
+
108
+ ### Write from PostgreSQL into PostgreSQL
109
+
110
+ Same server
111
+
112
+ ```python
113
+
114
+ table_dest = "public.test_table_write" # some table for write
115
+ table_src = "public.test_table_read" # some table for read
116
+ query_src = "select ..." # or some sql query for read
117
+
118
+ dumper.write_between(
119
+ table_dest,
120
+ table_src,
121
+ query_src,
122
+ )
123
+ ```
124
+
125
+ Different servers
126
+
127
+ ```python
128
+
129
+ connector_src = PGConnector(
130
+ host = <host src>,
131
+ dbname = <database src>,
132
+ user = <username src>,
133
+ password = <password src>,
134
+ port = <port src>,
135
+ )
136
+
137
+ dumper_src = PGPackDumper(connector=connector_src)
138
+
139
+ table_dest = "public.test_table_write" # some table for write
140
+ table_src = "public.test_table_read" # some table for read
141
+ query_src = "select ..." # or some sql query for read
142
+
143
+ dumper.write_between(
144
+ table_dest,
145
+ table_src,
146
+ query_src,
147
+ dumper_src,
148
+ )
149
+ ```
150
+
151
+ ### Get stream object
152
+
153
+ ```python
154
+ # you need define one of parameter query or table_name
155
+ query = "select ..." # some sql query
156
+ table_name = "public.test_table" # or some table
157
+ reader = dumper.to_reader(query=query, table_name=table_name)
158
+ print(reader)
159
+ # <PostgreSQL/GreenPlum stream reader>
160
+ # ┌─────────────────┬─────────────────┐
161
+ # │ Column Name │ PostgreSQL Type │
162
+ # ╞═════════════════╪═════════════════╡
163
+ # │ column1 │ date │
164
+ # │-----------------+-----------------│
165
+ # │ column2 │ bpchar │
166
+ # │-----------------+-----------------│
167
+ # │ column3 │ bpchar │
168
+ # └─────────────────┴─────────────────┘
169
+ # Total columns: 3
170
+ # Readed rows: 0
171
+ ```
172
+
173
+ StreamReader has three methods available,
174
+ but only one of the methods is available at a time within a single session.
175
+
176
+ ```python
177
+ # read as python generator object
178
+ reader.to_rows()
179
+ # or read as pandas.DataFrame
180
+ reader.to_pandas()
181
+ # or read as polars.DataFrame
182
+ reader.to_polars()
183
+ ```
184
+
185
+ ### Write from python objects into target table
186
+
187
+ ```python
188
+ # some table for write data
189
+ table_name = "public.test_table"
190
+ dtype_data: Itarable[Any]
191
+ pandas_frame: pandas.DataFrame
192
+ polars_frame: polars.DataFrame
193
+
194
+ # write from python object
195
+ dumper.from_rows(dtype_data, table_name)
196
+ # write from pandas.DataFrame
197
+ dumper.from_pandas(pandas_frame, table_name)
198
+ # write from polars.DataFrame
199
+ dumper.from_polars(polars_frame, table_name)
200
+ ```
201
+
202
+ ### Open PGPack file format
203
+
204
+ Get info from my another repository https://github.com/0xMihalich/pgpack
205
+
206
+ ## Installation
207
+
208
+ ### From pip
209
+
210
+ ```bash
211
+ pip install pgpack-dumper
212
+ ```
213
+
214
+ ### From local directory
215
+
216
+ ```bash
217
+ pip install .
218
+ ```
219
+
220
+ ### From git
221
+
222
+ ```bash
223
+ pip install git+https://github.com/0xMihalich/pgpack_dumper
224
+ ```
@@ -0,0 +1,31 @@
1
+ pgpack_dumper-0.3.4.7.dist-info/RECORD,,
2
+ pgpack_dumper-0.3.4.7.dist-info/WHEEL,sha256=4Cxp45cRJjM_RhSwJ40gZB-W75KdWWT7Z-2loeADFVA,138
3
+ pgpack_dumper-0.3.4.7.dist-info/top_level.txt,sha256=AhxLKWTyGtJWNLWUSyBu54xY4wjVS8vSXgW4wwq4bYk,14
4
+ pgpack_dumper-0.3.4.7.dist-info/METADATA,sha256=9wzWGBLOvi_iaEyd5-DZO3XAMtlnwLBmFmgsK4MlSlQ,6341
5
+ pgpack_dumper-0.3.4.7.dist-info/licenses/CHANGELOG.md,sha256=tkffNV7DBANkkKlKF-NflVem_Xg2tjEAzkpLWZeTjcI,5515
6
+ pgpack_dumper-0.3.4.7.dist-info/licenses/README.md,sha256=1wGcLUV7emCaUjyq1dnmZp4WNXj83Zpo9f5uEJcIkpY,3992
7
+ pgpack_dumper/version.py,sha256=y2gGAelDjVWw2bECJn1I1pvRD0s7MdxIJmPklKiEnOQ,24
8
+ pgpack_dumper/__init__.py,sha256=2x9LRaKPMjMuOoP9pBAeSRZoAeCo9B8fxFbnW_N7kh8,966
9
+ pgpack_dumper/dumper.py,sha256=3PXKBgXmmZT3Gm5wsWUDnDU-vici7aPuGoejeJeNSMA,14469
10
+ pgpack_dumper/common/metadata.py,sha256=a7upZYY3SHC0d4oBXMItmeAK9x3EsrJn0hLrUDmjlNA,1013
11
+ pgpack_dumper/common/diagram.py,sha256=2w5-s5qwYjCd0cqqlBRbHQ8E90jU7Ay7TNLeROHjCa0,2505
12
+ pgpack_dumper/common/query.py,sha256=Ee5Tl2MRO1SFo-kRUZs14Rya81HLEYK-IiWeAh0DfDY,1555
13
+ pgpack_dumper/common/reader.pyx,sha256=vRIR558enMtx4gueWtoujJbpRoWbKnLWx_foVR-rxIw,1821
14
+ pgpack_dumper/common/__init__.py,sha256=gz-xk9TgMHVx5hlFnipO3kuLp7k3grb-OhoSP5Y7LvU,1242
15
+ pgpack_dumper/common/copy.py,sha256=9cRiWFJLN8zHXuzdcajv3OAsoutBTp8JZknA2aV7T9k,5003
16
+ pgpack_dumper/common/logger.py,sha256=gsFCOjnCU3Hvg5UGYMVrPjKRCZKRFtBFBX-7QLZshFo,1675
17
+ pgpack_dumper/common/stream.py,sha256=PXWcxmDmuK7ueI3MTUfQnmXKWz3A99W-knNRvq_-ZG0,2245
18
+ pgpack_dumper/common/columns.py,sha256=Pa8bzhoi8tXbm3GlgVeHYM3auPORD41q-L29JF_pRqM,693
19
+ pgpack_dumper/common/structs.py,sha256=gS7vT-_yZ6R45j212B0kYKCJgHalxkdEN84Itctv7Ok,1033
20
+ pgpack_dumper/common/connector.py,sha256=WGBovyXWxgeseGXploUW0L_4R0GQBtuInl89zqvbKLY,176
21
+ pgpack_dumper/common/reader.pxd,sha256=flQddQni7UgYU_XPGpnILc7GVDFYjRgq-tbKRTUPbE8,252
22
+ pgpack_dumper/common/reader.pyi,sha256=UoW-mEAw_G7TLBbIoPTJwpdtucv5IygHdkHc_ZcVM5Y,675
23
+ pgpack_dumper/common/errors.py,sha256=1WIe9PUq5-Q6VNWyWAaXWr7xuXS2ixJCUB5sDOi5Xgs,591
24
+ pgpack_dumper/common/reader.cpython-314-darwin.so,sha256=AnRJukwS6H4gLSIudEtW9z1k4fGglzpb6faCytKc4s0,80264
25
+ pgpack_dumper/common/queryes/copy_from.sql,sha256=71abFg8LYFbyn_1vxvU1fCOkoV6VUfsZQLuvcTde65E,50
26
+ pgpack_dumper/common/queryes/gpversion.sql,sha256=iUwW40pFCVAZhDZ6ah8CIW75_KMBLyvUxMyqOI7vxtA,80
27
+ pgpack_dumper/common/queryes/relkind.sql,sha256=wpyWaIiuCqQ0YaFPsNAEwwxSxuErNnRmP__-bfZ1vho,66
28
+ pgpack_dumper/common/queryes/copy_to.sql,sha256=tkS9wjbU5T3HBi9HduXRhIDS6lV5v135dDyNRF5ahSI,49
29
+ pgpack_dumper/common/queryes/attributes.sql,sha256=4hGJ6UYhbsqj-pspUk9uJ72h4a2YDpI0QpSjrCcqtt0,595
30
+ pgpack_dumper/common/queryes/dbname.sql,sha256=Z3b6a_566PxA52ywRJw1JDSCUMC_c-FyulvW8mC1C7c,141
31
+ pgpack_dumper/common/queryes/prepare.sql,sha256=oqRk3GU0gjFzM0nLNsKWeD8GfeThZVKsFiMY1-tdb8g,182
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-macosx_10_15_x86_64
5
+ Generator: delocate 0.13.0
6
+
@@ -0,0 +1,242 @@
1
+ # Version History
2
+
3
+ ## 0.3.4.7
4
+
5
+ * Update depends pgcopylib==0.2.3.2
6
+ * Update depends pgpack==0.3.2.2
7
+ * Fix build from source on unix systems
8
+
9
+ ## 0.3.4.6
10
+
11
+ * Update depends pgcopylib==0.2.3.1
12
+ * Update depends pgpack==0.3.2.1
13
+
14
+ ## 0.3.4.5
15
+
16
+ * Update depends pgcopylib==0.2.3.0
17
+ * Update depends pgpack==0.3.2.0
18
+
19
+ ## 0.3.4.4
20
+
21
+ * Update depends pgcopylib==0.2.2.8
22
+ * Update depends pgpack==0.3.1.7
23
+
24
+ ## 0.3.4.3
25
+
26
+ * Fix read query with comments in last line
27
+ * Update depends pgcopylib==0.2.2.7
28
+ * Update depends pgpack==0.3.1.6
29
+ * Update depends psycopg_binary>=3.3.2
30
+ * Update depends psycopg>=3.3.2
31
+ * Back compile depends to cython>=0.29.33
32
+ * Make wheels for python 3.10-3.14
33
+
34
+ ## 0.3.4.2
35
+
36
+ * Update depends pgcopylib==0.2.2.6
37
+ * Update depends pgpack==0.3.1.5
38
+ * Downgrade compile depends to cython==0.29.33
39
+ * Make wheels for python 3.10 and 3.11 only
40
+
41
+ ## 0.3.4.1
42
+
43
+ * Update depends pgcopylib==0.2.2.5
44
+ * Update depends pgpack==0.3.1.4
45
+ * Improve invalid byte sequence for encoding "UTF8": 0x00
46
+ * Disable Linux Aarch64
47
+
48
+ ## 0.3.4.0
49
+
50
+ * Update depends pgcopylib==0.2.2.4
51
+ * Update depends pgpack==0.3.1.3
52
+ * Add auto convert String/FixedString(36) from Clickhouse data to Postgres uuid
53
+
54
+ ## 0.3.3.6
55
+
56
+ * Update depends pgcopylib==0.2.2.3
57
+ * Update depends pgpack==0.3.1.2
58
+ * Update depends psycopg>=3.3.0
59
+ * Update depends psycopg_binary>=3.3.0
60
+ * Update depends sqlparse>=0.5.4
61
+ * Fix write_timestamp error Can't subtract offset-naive and offset-aware datetimes
62
+
63
+ ## 0.3.3.5
64
+
65
+ * Fix diagram destination table
66
+ * Refactor PGPackDumper.__write_between()
67
+
68
+ ## 0.3.3.4
69
+
70
+ * Fix None query error
71
+
72
+ ## 0.3.3.3
73
+
74
+ * Fix query with limit state metadata read error
75
+ * Fix query end with ; metadata read error
76
+ * Del chunks after write
77
+ * Add gc collect
78
+
79
+ ## 0.3.3.2
80
+
81
+ * Fix write_between diagram
82
+
83
+ ## 0.3.3.1
84
+
85
+ * Improve chunk_query function
86
+
87
+ ## 0.3.3.0
88
+
89
+ * Fix attnum position in metadata (thnx to @Art_Dmitriev)
90
+ * Improve Multiquery decorator
91
+
92
+ ## 0.3.2.2
93
+
94
+ * Update depends pgpack==0.3.1.1
95
+ * Update depends psycopg_binary>=3.2.12
96
+ * Update depends psycopg==3.2.12
97
+
98
+ ## 0.3.2.1
99
+
100
+ * Improve get metadata for numeric column without precision (thnx to @Art_Dmitriev)
101
+
102
+ ## 0.3.2.0
103
+
104
+ * Fix chunk_query for ignoring semicolons inside string literals
105
+
106
+ ## 0.3.1.0
107
+
108
+ * Update depends pgpack==0.3.1.0
109
+
110
+ ## 0.3.0.0
111
+
112
+ * Update depends pgpack==0.3.0.9
113
+ * Update depends psycopg==3.2.11
114
+ * Change PGPackDumper.version to "*version number* gp *version number*" if greenplum detected
115
+ * Fix calc read size
116
+ * Fix multiquery wrapper
117
+ * Add transfer_diagram and DBMetadata to make log diagrams
118
+ * Add _dbmeta and _size attributes
119
+ * Add log output diagram
120
+ * Add auto upload to pip
121
+
122
+ ## 0.2.1.2
123
+
124
+ * Add dbname.sql & gpversion.sql to queryes directory
125
+ * Add PGPackDumper.dbname attribute to detect greenplum or postgres
126
+ * Change PGPackDumper.version to "version number|greenplum version number" if greenplum detected
127
+
128
+ ## 0.2.1.1
129
+
130
+ * Add wheels automake
131
+ * Update depends pgpack==0.3.0.8
132
+
133
+ ## 0.2.1.0
134
+
135
+ * Add *.pyi files for cython module descriptions
136
+ * Update MANIFEST.in
137
+ * Update depends pgpack==0.3.0.7
138
+ * Update depends setuptools==80.9.0
139
+
140
+ ## 0.2.0.7
141
+
142
+ * Update depends pgpack==0.3.0.6
143
+ * Add depends psycopg_binary>=3.2.10
144
+ * Add internal methods __read_dump, __write_between and __to_reader to force kwargs creation
145
+
146
+ ## 0.2.0.6
147
+
148
+ * Add tell() method to CopyReader
149
+ * Update requirements.txt depends pgpack==0.3.0.5
150
+
151
+ ## 0.2.0.5
152
+
153
+ * Delete attribute pos from CopyBuffer
154
+ * Add readed and sending size output into log
155
+
156
+ ## 0.2.0.4
157
+
158
+ * Update requirements.txt depends pgpack==0.3.0.4
159
+ * Update requirements.txt depends psycopg==3.2.10
160
+ * Fix logger create folder in initialize
161
+
162
+ ## 0.2.0.3
163
+
164
+ * Change log message
165
+ * Improve refresh database after write
166
+ * Improve initialization error
167
+ * Rename variable result to output
168
+
169
+ ## 0.2.0.2
170
+
171
+ * Update MANIFEST.in
172
+ * Update requirements.txt depends pgpack==0.3.0.3
173
+ * Improve pyproject.toml license file approve
174
+ * Add CHANGELOG.md to pip package
175
+ * Add close files after read/write operations
176
+ * Change log messages for read operations
177
+
178
+ ## 0.2.0.1
179
+
180
+ * Update requirements.txt depends pgpack==0.3.0.2
181
+ * Fix multiquery decorator
182
+ * Fix pgpack import
183
+
184
+ ## 0.2.0.0
185
+
186
+ * Redistribute project directories
187
+ * Add CopyReader class for read stream
188
+ * Add StreamReader class for read same as PGPack stream object
189
+ * Add new method to_reader(query, table_name) for get StreamReader
190
+ * Add new method from_rows(dtype_data, table_name) for write from python iterable object
191
+ * Add new methods from_pandas(data_frame, table_name) & from_polars(data_frame, table_name)
192
+ * Add new methods refresh() to refresh session & close() to close PGPackDumper
193
+ * Update requirements.txt
194
+ * Update README.md
195
+ * Change default compressor to ZSTD
196
+ * Change CopyBuffer.copy_reader() function
197
+ * Delete CopyBuffer read() & tell() functions
198
+ * Delete make_buffer_obj method
199
+
200
+ ## 0.1.2.2
201
+
202
+ * Hotfix root_dir() function
203
+
204
+ ## 0.1.2.1
205
+
206
+ * Add array nested into metadata
207
+ * Add attribute version
208
+ * Add more error classes
209
+ * Update requirements.txt
210
+ * Change initialized message to log
211
+ * Change multiquery log
212
+
213
+ ## 0.1.2
214
+
215
+ * Change metadata structure
216
+ * Update requirements.txt
217
+
218
+ ## 0.1.1
219
+
220
+ * Rename project to pgpack_dumper
221
+ * Fix legacy setup.py bdist_wheel mechanism, which will be removed in a future version
222
+ * Fix multiquery
223
+ * Add CHANGELOG.md
224
+
225
+ ## 0.1.0
226
+
227
+ * Add CopyBufferObjectError & CopyBufferTableNotDefined
228
+ * Add PGObject
229
+ * Add logger
230
+ * Add sqlparse for cut comments from query
231
+ * Add multiquery
232
+ * Update requirements.txt
233
+
234
+ ## 0.0.2
235
+
236
+ * Fix include *.sql
237
+ * Fix requirements.txt
238
+ * Docs change README.md
239
+
240
+ ## 0.0.1
241
+
242
+ First version of the library pgcrypt_dumper
@@ -0,0 +1,176 @@
1
+ # PGPackDumper
2
+
3
+ Library for read and write PGPack format between PostgreSQL and file
4
+
5
+ ## Examples
6
+
7
+ ### Initialization
8
+
9
+ ```python
10
+ from pgpack_dumper import (
11
+ CompressionMethod,
12
+ PGConnector,
13
+ PGPackDumper,
14
+ )
15
+
16
+ connector = PGConnector(
17
+ host = <your host>,
18
+ dbname = <your database>,
19
+ user = <your username>,
20
+ password = <your password>,
21
+ port = <your port>,
22
+ )
23
+
24
+ dumper = PGPackDumper(
25
+ connector=connector,
26
+ compression_method=CompressionMethod.ZSTD, # or CompressionMethod.LZ4 or CompressionMethod.NONE
27
+ )
28
+ ```
29
+
30
+ ### Read dump from PostgreSQL into file
31
+
32
+ ```python
33
+ file_name = "test_table.pgpack"
34
+ # you need define one of parameter query or table_name
35
+ query = "select ..." # some sql query
36
+ table_name = "public.test_table" # or some table
37
+
38
+ with open(file_name, "wb") as fileobj:
39
+ dumper.read_dump(
40
+ fileobj,
41
+ query,
42
+ table_name,
43
+ )
44
+ ```
45
+
46
+ ### Write dump from file into PostgreSQL
47
+
48
+ ```python
49
+ file_name = "test_table.pgpack"
50
+ # you need define one of parameter table_name
51
+ table_name = "public.test_table" # some table
52
+
53
+ with open(file_name, "rb") as fileobj:
54
+ dumper.write_dump(
55
+ fileobj,
56
+ table_name,
57
+ )
58
+ ```
59
+
60
+ ### Write from PostgreSQL into PostgreSQL
61
+
62
+ Same server
63
+
64
+ ```python
65
+
66
+ table_dest = "public.test_table_write" # some table for write
67
+ table_src = "public.test_table_read" # some table for read
68
+ query_src = "select ..." # or some sql query for read
69
+
70
+ dumper.write_between(
71
+ table_dest,
72
+ table_src,
73
+ query_src,
74
+ )
75
+ ```
76
+
77
+ Different servers
78
+
79
+ ```python
80
+
81
+ connector_src = PGConnector(
82
+ host = <host src>,
83
+ dbname = <database src>,
84
+ user = <username src>,
85
+ password = <password src>,
86
+ port = <port src>,
87
+ )
88
+
89
+ dumper_src = PGPackDumper(connector=connector_src)
90
+
91
+ table_dest = "public.test_table_write" # some table for write
92
+ table_src = "public.test_table_read" # some table for read
93
+ query_src = "select ..." # or some sql query for read
94
+
95
+ dumper.write_between(
96
+ table_dest,
97
+ table_src,
98
+ query_src,
99
+ dumper_src,
100
+ )
101
+ ```
102
+
103
+ ### Get stream object
104
+
105
+ ```python
106
+ # you need define one of parameter query or table_name
107
+ query = "select ..." # some sql query
108
+ table_name = "public.test_table" # or some table
109
+ reader = dumper.to_reader(query=query, table_name=table_name)
110
+ print(reader)
111
+ # <PostgreSQL/GreenPlum stream reader>
112
+ # ┌─────────────────┬─────────────────┐
113
+ # │ Column Name │ PostgreSQL Type │
114
+ # ╞═════════════════╪═════════════════╡
115
+ # │ column1 │ date │
116
+ # │-----------------+-----------------│
117
+ # │ column2 │ bpchar │
118
+ # │-----------------+-----------------│
119
+ # │ column3 │ bpchar │
120
+ # └─────────────────┴─────────────────┘
121
+ # Total columns: 3
122
+ # Readed rows: 0
123
+ ```
124
+
125
+ StreamReader has three methods available,
126
+ but only one of the methods is available at a time within a single session.
127
+
128
+ ```python
129
+ # read as python generator object
130
+ reader.to_rows()
131
+ # or read as pandas.DataFrame
132
+ reader.to_pandas()
133
+ # or read as polars.DataFrame
134
+ reader.to_polars()
135
+ ```
136
+
137
+ ### Write from python objects into target table
138
+
139
+ ```python
140
+ # some table for write data
141
+ table_name = "public.test_table"
142
+ dtype_data: Itarable[Any]
143
+ pandas_frame: pandas.DataFrame
144
+ polars_frame: polars.DataFrame
145
+
146
+ # write from python object
147
+ dumper.from_rows(dtype_data, table_name)
148
+ # write from pandas.DataFrame
149
+ dumper.from_pandas(pandas_frame, table_name)
150
+ # write from polars.DataFrame
151
+ dumper.from_polars(polars_frame, table_name)
152
+ ```
153
+
154
+ ### Open PGPack file format
155
+
156
+ Get info from my another repository https://github.com/0xMihalich/pgpack
157
+
158
+ ## Installation
159
+
160
+ ### From pip
161
+
162
+ ```bash
163
+ pip install pgpack-dumper
164
+ ```
165
+
166
+ ### From local directory
167
+
168
+ ```bash
169
+ pip install .
170
+ ```
171
+
172
+ ### From git
173
+
174
+ ```bash
175
+ pip install git+https://github.com/0xMihalich/pgpack_dumper
176
+ ```
@@ -0,0 +1 @@
1
+ pgpack_dumper