red-adbc 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 103a8db009e57dca75552680e60fafc7a6e66d712936c4a2392180a324d53847
4
- data.tar.gz: 184c9e9c79820696054d2614f25f420ebb7cc0247100ff4e1c63b408220a8a54
3
+ metadata.gz: 97bc5368186dbbb7e3f23357bba96d58ab2401e3c37a6cf2bcd039b9880875a7
4
+ data.tar.gz: b3e8197a27f928f8e29cd617928a2eccc2ac08717244f8395b055440d730a7ac
5
5
  SHA512:
6
- metadata.gz: b8eaa2b881babf7b437985a4367b7561ba5cb7dae622df7400a85bca8cd8bf260cbe416a1e2840235ed889137ef8a9aa3bab2fc4de72ea9d93d72d18a6fab998
7
- data.tar.gz: 544201d69a9bb188b4b1749c27d9d8c360bfdd99d86ceb646c8be5037e66d51d311db8dcbcb8fb49f53673d9a4e43519d6c5c1b20620b784f58cf9dccc400b2d
6
+ metadata.gz: 03f0422fea96fed1cb60caa6b5757b8744aab4c2c19e6a75b1c76fbdd6890baabb9df438cd1f1903472001029755e25ea90cd06195fd043e0d5127ccb189d9a8
7
+ data.tar.gz: d4bd60c141d0cb11cd4214f4189528214c2c4780fcb92a1c98f64d6bc87c178446f637dd4318e1567f761b49938751a86a79d7186056ab1b2fd0559c4315f177
data/LICENSE.txt CHANGED
@@ -246,6 +246,32 @@ All rights reserved.
246
246
 
247
247
  --------------------------------------------------------------------------------
248
248
 
249
+ 3rdparty dependency {fmt} is statically linked in certain binary
250
+ distributions, like the Python wheels. {fmt} is under the MIT license:
251
+
252
+ Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors
253
+
254
+ Permission is hereby granted, free of charge, to any person obtaining
255
+ a copy of this software and associated documentation files (the
256
+ "Software"), to deal in the Software without restriction, including
257
+ without limitation the rights to use, copy, modify, merge, publish,
258
+ distribute, sublicense, and/or sell copies of the Software, and to
259
+ permit persons to whom the Software is furnished to do so, subject to
260
+ the following conditions:
261
+
262
+ The above copyright notice and this permission notice shall be
263
+ included in all copies or substantial portions of the Software.
264
+
265
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
266
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
267
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
268
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
269
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
270
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
271
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
272
+
273
+ --------------------------------------------------------------------------------
274
+
249
275
  3rdparty dependency Go is statically linked in certain binary distributions,
250
276
  like the Python wheels. The Go project is under the BSD 3-clause license +
251
277
  PATENTS weak patent termination clause
@@ -281,6 +307,33 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281
307
 
282
308
  --------------------------------------------------------------------------------
283
309
 
310
+ 3rdparty dependency backward-cpp is statically linked in certain binary
311
+ distributions, like the Python wheels. backward-cpp has the following license:
312
+
313
+ Copyright 2013 Google Inc. All Rights Reserved.
314
+
315
+ The MIT License (MIT)
316
+
317
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
318
+ this software and associated documentation files (the "Software"), to deal in
319
+ the Software without restriction, including without limitation the rights to
320
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
321
+ of the Software, and to permit persons to whom the Software is furnished to do
322
+ so, subject to the following conditions:
323
+
324
+ The above copyright notice and this permission notice shall be included in all
325
+ copies or substantial portions of the Software.
326
+
327
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
328
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
329
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
330
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
331
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
332
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
333
+ SOFTWARE.
334
+
335
+ --------------------------------------------------------------------------------
336
+
284
337
  3rdparty dependency libpq is statically linked in certain binary
285
338
  distributions, like the Python wheels. libpq has the following license:
286
339
 
@@ -34,12 +34,12 @@ end
34
34
  namespace :dependency do
35
35
  desc "Check dependency"
36
36
  task :check do
37
- unless PKGConfig.check_version?("adbc-glib",
37
+ unless PKGConfig.check_version?("adbc-arrow-glib",
38
38
  ADBC::Version::MAJOR,
39
39
  ADBC::Version::MINOR,
40
40
  ADBC::Version::MICRO)
41
- unless NativePackageInstaller.install(debian: "libadbc-glib-dev",
42
- redhat: "adbc-glib-devel")
41
+ unless NativePackageInstaller.install(debian: "libadbc-arrow-glib-dev",
42
+ redhat: "adbc-arrow-glib-devel")
43
43
  exit(false)
44
44
  end
45
45
  end
@@ -0,0 +1,65 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module ADBCArrow
19
+ class Statement
20
+ extend ADBC::StatementOpenable
21
+ include ADBC::StatementOperations
22
+
23
+ alias_method :execute_raw, :execute
24
+ def execute(need_result: true)
25
+ _, reader, n_rows_affected = execute_raw(need_result)
26
+ if need_result
27
+ begin
28
+ if block_given?
29
+ yield(reader, n_rows_affected)
30
+ else
31
+ [reader.read_all, n_rows_affected]
32
+ end
33
+ end
34
+ else
35
+ if block_given?
36
+ yield(n_rows_affected)
37
+ else
38
+ n_rows_affected
39
+ end
40
+ end
41
+ end
42
+
43
+ alias_method :bind_raw, :bind
44
+ def bind(*args)
45
+ n_args = args.size
46
+ if block_given?
47
+ message = "wrong number of arguments (given #{n_args}, expected 1 with block)"
48
+ raise ArgumentError, message unless n_args == 1
49
+ values = args[0]
50
+ if values.is_a?(Arrow::Table)
51
+ values = Arrow::TableBatchReader.new(values)
52
+ end
53
+ if values.is_a?(Arrow::RecordBatchReader)
54
+ bind_stream(values)
55
+ yield
56
+ else
57
+ bind_raw(values)
58
+ yield
59
+ end
60
+ else
61
+ bind_raw(*args)
62
+ end
63
+ end
64
+ end
65
+ end
data/lib/adbc/loader.rb CHANGED
@@ -43,3 +43,22 @@ module ADBC
43
43
  end
44
44
  end
45
45
  end
46
+
47
+ module ADBCArrow
48
+ class Loader < GObjectIntrospection::Loader
49
+ class << self
50
+ def load
51
+ super("ADBCArrow", ADBCArrow)
52
+ end
53
+ end
54
+
55
+ private
56
+ def post_load(repository, namespace)
57
+ require_libraries
58
+ end
59
+
60
+ def require_libraries
61
+ require_relative "arrow-statement"
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,33 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module ADBC
19
+ module StatementOpenable
20
+ def open(connection)
21
+ statement = new(connection)
22
+ if block_given?
23
+ begin
24
+ yield(statement)
25
+ ensure
26
+ statement.release
27
+ end
28
+ else
29
+ statement
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module ADBC
19
+ module StatementOperations
20
+ def ingest(table_name, values, mode: :create)
21
+ self.ingest_target_table = table_name
22
+ self.ingest_mode = mode
23
+ bind(values) do
24
+ execute(need_result: false)
25
+ end
26
+ end
27
+
28
+ def query(sql, &block)
29
+ self.sql_query = sql
30
+ execute(&block)
31
+ end
32
+ end
33
+ end
@@ -15,22 +15,13 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
+ require_relative "statement-openable"
19
+ require_relative "statement-operations"
20
+
18
21
  module ADBC
19
22
  class Statement
20
- class << self
21
- def open(connection)
22
- statement = new(connection)
23
- if block_given?
24
- begin
25
- yield(statement)
26
- ensure
27
- statement.release
28
- end
29
- else
30
- statement
31
- end
32
- end
33
- end
23
+ extend StatementOpenable
24
+ include StatementOperations
34
25
 
35
26
  alias_method :execute_raw, :execute
36
27
  def execute(need_result: true)
@@ -94,25 +85,5 @@ module ADBC
94
85
  bind_raw(*args)
95
86
  end
96
87
  end
97
-
98
- def ingest(table_name, values, mode: :create)
99
- insert = "INSERT INTO #{table_name} (" # TODO escape
100
- fields = values.schema.fields
101
- insert << fields.collect(&:name).join(", ")
102
- insert << ") VALUES ("
103
- insert << (["?"] * fields.size).join(", ")
104
- insert << ")"
105
- self.sql_query = insert
106
- self.ingest_target_table = table_name
107
- self.ingest_mode = mode
108
- bind(values) do
109
- execute(need_result: false)
110
- end
111
- end
112
-
113
- def query(sql, &block)
114
- self.sql_query = sql
115
- execute(&block)
116
- end
117
88
  end
118
89
  end
data/lib/adbc/version.rb CHANGED
@@ -16,7 +16,7 @@
16
16
  # under the License.
17
17
 
18
18
  module ADBC
19
- VERSION = "0.9.0"
19
+ VERSION = "0.11.0"
20
20
 
21
21
  module Version
22
22
  MAJOR, MINOR, MICRO, TAG = VERSION.split(".").collect(&:to_i)
data/lib/adbc.rb CHANGED
@@ -24,6 +24,16 @@ require "adbc/loader"
24
24
  module ADBC
25
25
  class Error < StandardError
26
26
  end
27
+ end
27
28
 
28
- Loader.load
29
+ ADBC::Loader.load
30
+ begin
31
+ ADBCArrow::Loader.load
32
+ rescue GObjectIntrospection::RepositoryError
33
+ else
34
+ module ADBC
35
+ RawStatement = Statement
36
+ remove_const(:Statement)
37
+ Statement = ADBCArrow::Statement
38
+ end
29
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red-adbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Arrow Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: red-arrow
@@ -38,9 +38,12 @@ files:
38
38
  - README.md
39
39
  - dependency-check/Rakefile
40
40
  - lib/adbc.rb
41
+ - lib/adbc/arrow-statement.rb
41
42
  - lib/adbc/connection.rb
42
43
  - lib/adbc/database.rb
43
44
  - lib/adbc/loader.rb
45
+ - lib/adbc/statement-openable.rb
46
+ - lib/adbc/statement-operations.rb
44
47
  - lib/adbc/statement.rb
45
48
  - lib/adbc/version.rb
46
49
  homepage: https://arrow.apache.org/