red-adbc 0.11.0 → 1.0.0
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.
- checksums.yaml +4 -4
- data/lib/adbc/arrow-connection.rb +36 -0
- data/lib/adbc/connection-operations.rb +56 -0
- data/lib/adbc/connection.rb +8 -34
- data/lib/adbc/loader.rb +1 -0
- data/lib/adbc/version.rb +1 -1
- data/lib/adbc.rb +4 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3e38661bb51d363808e530520d34e2db0c9ee10760e3131a3fc29ce8d24603c
|
4
|
+
data.tar.gz: bfa56ab21c18d1d415c80b1f702f74a8b65b249e414ae81fe175ac32fa1668d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227b2de351ca2a2470a87899255eb0d42f563549c556de83e79c5198f1591de5bb620c6f359c91061471bed5dcdb70a8fe2db3c5175eaadd490a5cda50098e9f
|
7
|
+
data.tar.gz: 640804850814b5bab21f6c3cc5f50b443104c79b15bbb440d271d78870bdec43f55f5739dc73aebb9cbf08577c512aa4466dfc7efab18edf08a9af34d69220a1
|
@@ -0,0 +1,36 @@
|
|
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 Connection
|
20
|
+
include ADBC::ConnectionOperations
|
21
|
+
|
22
|
+
def open_statement(&block)
|
23
|
+
Statement.open(self, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
alias_method :get_info_raw, :get_info
|
27
|
+
def get_info(codes)
|
28
|
+
reader = get_info_raw(codes)
|
29
|
+
begin
|
30
|
+
yield(reader.read_all)
|
31
|
+
ensure
|
32
|
+
reader.unref
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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 ConnectionOperations
|
20
|
+
def query(sql, &block)
|
21
|
+
open_statement do |statement|
|
22
|
+
statement.query(sql, &block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def ingest(table_name, values, mode: :create)
|
27
|
+
open_statment do |statement|
|
28
|
+
statement.ingest(table_name, values, mode: mode)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def info(codes=nil)
|
33
|
+
unless codes.nil?
|
34
|
+
codes = codes.collect do |code|
|
35
|
+
ADBC::Info.try_convert(code)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
get_info(codes) do |table|
|
39
|
+
values = {}
|
40
|
+
table.raw_records.each do |code, value|
|
41
|
+
value = value.values[0] if value.is_a?(Hash)
|
42
|
+
code = ADBC::Info.try_convert(code)
|
43
|
+
values[code.nick.gsub("-", "_").to_sym] = value
|
44
|
+
end
|
45
|
+
values
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
ADBC::Info.values.each do |value|
|
50
|
+
name = value.nick.gsub("-", "_").to_sym
|
51
|
+
define_method(name) do
|
52
|
+
info([name])[name]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/adbc/connection.rb
CHANGED
@@ -15,42 +15,23 @@
|
|
15
15
|
# specific language governing permissions and limitations
|
16
16
|
# under the License.
|
17
17
|
|
18
|
+
require_relative "connection-operations"
|
19
|
+
|
18
20
|
module ADBC
|
19
21
|
class Connection
|
22
|
+
include ConnectionOperations
|
23
|
+
|
20
24
|
def open_statement(&block)
|
21
25
|
Statement.open(self, &block)
|
22
26
|
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def ingest(table_name, values, mode: :create)
|
31
|
-
open_statment do |statement|
|
32
|
-
statement.ingest(table_name, values, mode: mode)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def info(codes=nil)
|
37
|
-
unless codes.nil?
|
38
|
-
codes = codes.collect do |code|
|
39
|
-
ADBC::Info.try_convert(code)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
c_abi_array_stream = get_info(codes)
|
28
|
+
alias_method :get_info_raw, :get_info
|
29
|
+
def get_info(codes)
|
30
|
+
c_abi_array_stream = get_info_raw(codes)
|
43
31
|
begin
|
44
32
|
reader = Arrow::RecordBatchReader.import(c_abi_array_stream)
|
45
33
|
begin
|
46
|
-
|
47
|
-
values = {}
|
48
|
-
table.raw_records.each do |code, value|
|
49
|
-
value = value.values[0] if value.is_a?(Hash)
|
50
|
-
code = ADBC::Info.try_convert(code)
|
51
|
-
values[code.nick.gsub("-", "_").to_sym] = value
|
52
|
-
end
|
53
|
-
values
|
34
|
+
yield(reader.read_all)
|
54
35
|
ensure
|
55
36
|
reader.unref
|
56
37
|
end
|
@@ -58,12 +39,5 @@ module ADBC
|
|
58
39
|
GLib.free(c_abi_array_stream)
|
59
40
|
end
|
60
41
|
end
|
61
|
-
|
62
|
-
ADBC::Info.values.each do |value|
|
63
|
-
name = value.nick.gsub("-", "_").to_sym
|
64
|
-
define_method(name) do
|
65
|
-
info([name])[name]
|
66
|
-
end
|
67
|
-
end
|
68
42
|
end
|
69
43
|
end
|
data/lib/adbc/loader.rb
CHANGED
data/lib/adbc/version.rb
CHANGED
data/lib/adbc.rb
CHANGED
@@ -32,6 +32,10 @@ begin
|
|
32
32
|
rescue GObjectIntrospection::RepositoryError
|
33
33
|
else
|
34
34
|
module ADBC
|
35
|
+
RawConnection = Connection
|
36
|
+
remove_const(:Connection)
|
37
|
+
Connection = ADBCArrow::Connection
|
38
|
+
|
35
39
|
RawStatement = Statement
|
36
40
|
remove_const(:Statement)
|
37
41
|
Statement = ADBCArrow::Statement
|
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.
|
4
|
+
version: 1.0.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-
|
11
|
+
date: 2024-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: red-arrow
|
@@ -38,7 +38,9 @@ files:
|
|
38
38
|
- README.md
|
39
39
|
- dependency-check/Rakefile
|
40
40
|
- lib/adbc.rb
|
41
|
+
- lib/adbc/arrow-connection.rb
|
41
42
|
- lib/adbc/arrow-statement.rb
|
43
|
+
- lib/adbc/connection-operations.rb
|
42
44
|
- lib/adbc/connection.rb
|
43
45
|
- lib/adbc/database.rb
|
44
46
|
- lib/adbc/loader.rb
|