sequelizer 0.1.6 → 0.2.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/.beads/.gitignore +54 -0
- data/.beads/.jsonl.lock +0 -0
- data/.beads/.migration-hint-ts +1 -0
- data/.beads/README.md +81 -0
- data/.beads/config.yaml +42 -0
- data/.beads/issues.jsonl +20 -0
- data/.beads/metadata.json +7 -0
- data/.coderabbit.yaml +94 -0
- data/.github/dependabot.yml +18 -0
- data/.github/workflows/dependabot-auto-merge.yml +36 -0
- data/.github/workflows/test.yml +44 -9
- data/AGENTS.md +126 -0
- data/CHANGELOG.md +17 -0
- data/CLAUDE.md +11 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +84 -53
- data/config/platforms/base.csv +5 -0
- data/config/platforms/rdbms/athena.csv +4 -0
- data/config/platforms/rdbms/postgres.csv +3 -0
- data/config/platforms/rdbms/snowflake.csv +1 -0
- data/config/platforms/rdbms/spark.csv +3 -0
- data/lib/sequel/extensions/cold_col.rb +2 -2
- data/lib/sequel/extensions/funky.rb +136 -0
- data/lib/sequel/extensions/make_readyable.rb +0 -2
- data/lib/sequel/extensions/platform.rb +301 -0
- data/lib/sequelizer/options.rb +5 -1
- data/lib/sequelizer/version.rb +1 -1
- data/lib/sequelizer/yaml_config.rb +0 -1
- data/sequelizer.gemspec +10 -7
- data/test/lib/sequel/extensions/test_cold_col.rb +2 -2
- data/test/lib/sequel/extensions/test_make_readyable.rb +0 -1
- data/test/lib/sequel/extensions/test_platform.rb +222 -0
- data/test/lib/sequelizer/test_connection_maker.rb +2 -2
- data/test/lib/sequelizer/test_gemfile_modifier.rb +2 -2
- data/test/lib/sequelizer/test_options.rb +28 -0
- data/test/test_helper.rb +1 -0
- metadata +97 -19
- data/.claude/settings.local.json +0 -64
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,54 +1,61 @@
|
|
|
1
1
|
GIT
|
|
2
2
|
remote: https://github.com/outcomesinsights/sequel-hexspace.git
|
|
3
|
-
revision:
|
|
3
|
+
revision: 91ff040fac46380e2b35406ab4c8a7041beacd25
|
|
4
4
|
branch: master
|
|
5
5
|
specs:
|
|
6
6
|
sequel-hexspace (1.0.0)
|
|
7
|
-
hexspace
|
|
7
|
+
hexspace (>= 0.2.1)
|
|
8
8
|
sequel (~> 5.0)
|
|
9
9
|
|
|
10
10
|
PATH
|
|
11
11
|
remote: .
|
|
12
12
|
specs:
|
|
13
|
-
sequelizer (0.
|
|
14
|
-
activesupport (
|
|
15
|
-
dotenv (
|
|
16
|
-
hashie (
|
|
13
|
+
sequelizer (0.2.0)
|
|
14
|
+
activesupport (>= 7, < 9)
|
|
15
|
+
dotenv (>= 2.1, < 4.0)
|
|
16
|
+
hashie (>= 3.2, < 6.0)
|
|
17
|
+
kvcsv (~> 0.1)
|
|
18
|
+
pp
|
|
17
19
|
sequel (~> 5.93)
|
|
18
20
|
thor (~> 1.0)
|
|
19
21
|
|
|
20
22
|
GEM
|
|
21
23
|
remote: https://rubygems.org/
|
|
22
24
|
specs:
|
|
23
|
-
activesupport (
|
|
25
|
+
activesupport (8.1.2)
|
|
24
26
|
base64
|
|
25
|
-
benchmark (>= 0.3)
|
|
26
27
|
bigdecimal
|
|
27
28
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
28
29
|
connection_pool (>= 2.2.5)
|
|
29
30
|
drb
|
|
30
31
|
i18n (>= 1.6, < 2)
|
|
32
|
+
json
|
|
31
33
|
logger (>= 1.4.2)
|
|
32
34
|
minitest (>= 5.1)
|
|
33
35
|
securerandom (>= 0.3)
|
|
34
36
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
37
|
+
uri (>= 0.13.1)
|
|
38
|
+
addressable (2.8.8)
|
|
39
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
35
40
|
ast (2.4.3)
|
|
36
41
|
base64 (0.3.0)
|
|
37
|
-
|
|
38
|
-
bigdecimal (3.2.2)
|
|
42
|
+
bigdecimal (4.0.1)
|
|
39
43
|
childprocess (5.1.0)
|
|
40
44
|
logger (~> 1.5)
|
|
41
45
|
coderay (1.1.3)
|
|
42
|
-
concurrent-ruby (1.3.
|
|
43
|
-
connection_pool (
|
|
46
|
+
concurrent-ruby (1.3.6)
|
|
47
|
+
connection_pool (3.0.2)
|
|
48
|
+
csv (3.3.5)
|
|
44
49
|
docile (1.4.1)
|
|
45
|
-
dotenv (2.
|
|
50
|
+
dotenv (3.2.0)
|
|
46
51
|
drb (2.2.3)
|
|
47
|
-
ffi (1.
|
|
48
|
-
formatador (1.
|
|
49
|
-
|
|
52
|
+
ffi (1.17.3-x86_64-linux-gnu)
|
|
53
|
+
formatador (1.2.3)
|
|
54
|
+
reline
|
|
55
|
+
guard (2.20.1)
|
|
50
56
|
formatador (>= 0.2.4)
|
|
51
57
|
listen (>= 2.7, < 4.0)
|
|
58
|
+
logger (~> 1.6)
|
|
52
59
|
lumberjack (>= 1.0.12, < 2.0)
|
|
53
60
|
nenv (~> 0.1)
|
|
54
61
|
notiffany (~> 0.0)
|
|
@@ -56,98 +63,122 @@ GEM
|
|
|
56
63
|
shellany (~> 0.0)
|
|
57
64
|
thor (>= 0.18.1)
|
|
58
65
|
guard-compat (1.2.1)
|
|
59
|
-
guard-minitest (
|
|
66
|
+
guard-minitest (3.0.0)
|
|
60
67
|
guard-compat (~> 1.2)
|
|
61
|
-
minitest (>=
|
|
62
|
-
hashie (
|
|
63
|
-
|
|
68
|
+
minitest (>= 5.0.4, < 7.0)
|
|
69
|
+
hashie (5.1.0)
|
|
70
|
+
logger
|
|
71
|
+
hexspace (0.3.0)
|
|
72
|
+
bigdecimal
|
|
64
73
|
thrift (>= 0.18)
|
|
65
|
-
i18n (1.14.
|
|
74
|
+
i18n (1.14.8)
|
|
66
75
|
concurrent-ruby (~> 1.0)
|
|
67
76
|
iniparse (1.5.0)
|
|
68
|
-
|
|
77
|
+
io-console (0.8.2)
|
|
78
|
+
json (2.18.1)
|
|
79
|
+
json-schema (6.1.0)
|
|
80
|
+
addressable (~> 2.8)
|
|
81
|
+
bigdecimal (>= 3.1, < 5)
|
|
82
|
+
kvcsv (0.1.0)
|
|
83
|
+
csv (~> 3.0)
|
|
69
84
|
language_server-protocol (3.17.0.5)
|
|
70
85
|
lint_roller (1.1.0)
|
|
71
|
-
listen (3.
|
|
86
|
+
listen (3.10.0)
|
|
87
|
+
logger
|
|
72
88
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
73
89
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
74
90
|
logger (1.7.0)
|
|
75
|
-
lumberjack (1.2
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
lumberjack (1.4.2)
|
|
92
|
+
mcp (0.7.1)
|
|
93
|
+
json-schema (>= 4.1)
|
|
94
|
+
method_source (1.1.0)
|
|
95
|
+
minitest (6.0.2)
|
|
96
|
+
drb (~> 2.0)
|
|
97
|
+
prism (~> 1.5)
|
|
98
|
+
minitest-mock (5.27.0)
|
|
78
99
|
nenv (0.3.0)
|
|
79
100
|
notiffany (0.1.3)
|
|
80
101
|
nenv (~> 0.1)
|
|
81
102
|
shellany (~> 0.0)
|
|
82
|
-
overcommit (0.
|
|
103
|
+
overcommit (0.68.0)
|
|
83
104
|
childprocess (>= 0.6.3, < 6)
|
|
84
105
|
iniparse (~> 1.4)
|
|
85
106
|
rexml (>= 3.3.9)
|
|
86
107
|
parallel (1.27.0)
|
|
87
|
-
parser (3.3.
|
|
108
|
+
parser (3.3.10.2)
|
|
88
109
|
ast (~> 2.4.1)
|
|
89
110
|
racc
|
|
90
|
-
pg (1.6.
|
|
91
|
-
|
|
92
|
-
|
|
111
|
+
pg (1.6.3-x86_64-linux)
|
|
112
|
+
pp (0.6.3)
|
|
113
|
+
prettyprint
|
|
114
|
+
prettyprint (0.2.0)
|
|
115
|
+
prism (1.9.0)
|
|
116
|
+
pry (0.16.0)
|
|
93
117
|
coderay (~> 1.1)
|
|
94
118
|
method_source (~> 1.0)
|
|
119
|
+
reline (>= 0.6.0)
|
|
120
|
+
public_suffix (7.0.2)
|
|
95
121
|
racc (1.8.1)
|
|
96
122
|
rainbow (3.1.1)
|
|
97
|
-
rake (
|
|
123
|
+
rake (13.3.1)
|
|
98
124
|
rb-fsevent (0.11.2)
|
|
99
|
-
rb-inotify (0.
|
|
125
|
+
rb-inotify (0.11.1)
|
|
100
126
|
ffi (~> 1.0)
|
|
101
|
-
regexp_parser (2.
|
|
102
|
-
|
|
103
|
-
|
|
127
|
+
regexp_parser (2.11.3)
|
|
128
|
+
reline (0.6.3)
|
|
129
|
+
io-console (~> 0.5)
|
|
130
|
+
rexml (3.4.4)
|
|
131
|
+
rubocop (1.85.0)
|
|
104
132
|
json (~> 2.3)
|
|
105
133
|
language_server-protocol (~> 3.17.0.2)
|
|
106
134
|
lint_roller (~> 1.1.0)
|
|
135
|
+
mcp (~> 0.6)
|
|
107
136
|
parallel (~> 1.10)
|
|
108
137
|
parser (>= 3.3.0.2)
|
|
109
138
|
rainbow (>= 2.2.2, < 4.0)
|
|
110
139
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
111
|
-
rubocop-ast (>= 1.
|
|
140
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
112
141
|
ruby-progressbar (~> 1.7)
|
|
113
142
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
114
|
-
rubocop-ast (1.
|
|
143
|
+
rubocop-ast (1.49.0)
|
|
115
144
|
parser (>= 3.3.7.2)
|
|
116
|
-
prism (~> 1.
|
|
117
|
-
rubocop-minitest (0.
|
|
145
|
+
prism (~> 1.7)
|
|
146
|
+
rubocop-minitest (0.39.1)
|
|
118
147
|
lint_roller (~> 1.1)
|
|
119
148
|
rubocop (>= 1.75.0, < 2.0)
|
|
120
149
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
121
150
|
ruby-progressbar (1.13.0)
|
|
122
151
|
securerandom (0.4.1)
|
|
123
|
-
sequel (5.
|
|
152
|
+
sequel (5.101.0)
|
|
124
153
|
bigdecimal
|
|
125
154
|
shellany (0.0.1)
|
|
126
155
|
simplecov (0.22.0)
|
|
127
156
|
docile (~> 1.1)
|
|
128
157
|
simplecov-html (~> 0.11)
|
|
129
158
|
simplecov_json_formatter (~> 0.1)
|
|
130
|
-
simplecov-html (0.13.
|
|
159
|
+
simplecov-html (0.13.2)
|
|
131
160
|
simplecov_json_formatter (0.1.4)
|
|
132
|
-
thor (1.
|
|
133
|
-
thrift (0.
|
|
161
|
+
thor (1.5.0)
|
|
162
|
+
thrift (0.22.0)
|
|
134
163
|
tzinfo (2.0.6)
|
|
135
164
|
concurrent-ruby (~> 1.0)
|
|
136
|
-
unicode-display_width (3.
|
|
137
|
-
unicode-emoji (~> 4.
|
|
138
|
-
unicode-emoji (4.0
|
|
165
|
+
unicode-display_width (3.2.0)
|
|
166
|
+
unicode-emoji (~> 4.1)
|
|
167
|
+
unicode-emoji (4.2.0)
|
|
168
|
+
uri (1.1.1)
|
|
139
169
|
|
|
140
170
|
PLATFORMS
|
|
141
171
|
x86_64-linux
|
|
142
172
|
|
|
143
173
|
DEPENDENCIES
|
|
144
|
-
bundler (
|
|
174
|
+
bundler (>= 2.0)
|
|
145
175
|
guard (~> 2.0)
|
|
146
|
-
guard-minitest (~>
|
|
147
|
-
minitest (~>
|
|
148
|
-
|
|
176
|
+
guard-minitest (~> 3.0)
|
|
177
|
+
minitest (~> 6.0)
|
|
178
|
+
minitest-mock (~> 5.27)
|
|
179
|
+
overcommit (~> 0.68)
|
|
149
180
|
pg (~> 1.0)
|
|
150
|
-
rake (~>
|
|
181
|
+
rake (~> 13.3)
|
|
151
182
|
rubocop (~> 1.0)
|
|
152
183
|
rubocop-minitest (~> 0.25)
|
|
153
184
|
sequel-hexspace!
|
|
@@ -155,4 +186,4 @@ DEPENDENCIES
|
|
|
155
186
|
simplecov (~> 0.22)
|
|
156
187
|
|
|
157
188
|
BUNDLED WITH
|
|
158
|
-
2.
|
|
189
|
+
2.6.9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
key,value
|
|
@@ -292,7 +292,7 @@ module Sequel
|
|
|
292
292
|
# @param opts_chain [Hash] the dataset's query options
|
|
293
293
|
# @return [Array<Symbol>] array of column names from table.* expressions
|
|
294
294
|
def extract_table_star_columns(cols, opts_chain)
|
|
295
|
-
cols.
|
|
295
|
+
cols.grep(Sequel::SQL::ColumnAll)
|
|
296
296
|
.flat_map { |c| from_named_sources(c.table, opts_chain) }
|
|
297
297
|
end
|
|
298
298
|
|
|
@@ -359,7 +359,7 @@ module Sequel
|
|
|
359
359
|
# @return [Array<Symbol>, nil] column names if found, nil otherwise
|
|
360
360
|
def find_from_alias(name, opts_chain)
|
|
361
361
|
from = (opts_chain[:from] || [])
|
|
362
|
-
.
|
|
362
|
+
.grep(Sequel::SQL::AliasedExpression)
|
|
363
363
|
.detect { |f| literal(f.alias) == literal(name) }
|
|
364
364
|
|
|
365
365
|
from&.expression&.columns_search(opts_chain)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
module Sequel
|
|
2
|
+
|
|
3
|
+
module Funky
|
|
4
|
+
|
|
5
|
+
class FunkyBase
|
|
6
|
+
|
|
7
|
+
def initialize(db)
|
|
8
|
+
@db = db
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def to_strptime(format)
|
|
12
|
+
return format if format =~ /%/
|
|
13
|
+
|
|
14
|
+
format.gsub('yyyy', '%Y').gsub('MM', '%m').gsub('dd', '%d')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def from_strptime(format)
|
|
18
|
+
return format unless format =~ /%/
|
|
19
|
+
|
|
20
|
+
format.gsub('%Y', 'yyyy').gsub('%m', 'MM').gsub('%d', 'dd')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class FunkySpark < FunkyBase
|
|
26
|
+
|
|
27
|
+
def str_to_date(value, format, try: false) # rubocop:disable Lint/UnusedMethodArgument
|
|
28
|
+
Sequel.function(:to_date, Sequel.cast_string(value), format)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def hash(*)
|
|
32
|
+
Sequel.function(:xxhash64, *)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def make_json_column(ds, key_column, value_column)
|
|
36
|
+
json_object_col = Sequel.function(
|
|
37
|
+
:named_struct,
|
|
38
|
+
'key',
|
|
39
|
+
key_column,
|
|
40
|
+
'value',
|
|
41
|
+
value_column,
|
|
42
|
+
).then do |json_object_col|
|
|
43
|
+
Sequel.function(
|
|
44
|
+
:collect_list,
|
|
45
|
+
json_object_col,
|
|
46
|
+
)
|
|
47
|
+
end.then do |list_col|
|
|
48
|
+
Sequel.function(
|
|
49
|
+
:map_from_entries,
|
|
50
|
+
list_col,
|
|
51
|
+
)
|
|
52
|
+
end.then do |map_from_entries_col|
|
|
53
|
+
Sequel.function(
|
|
54
|
+
:to_json,
|
|
55
|
+
map_from_entries_col,
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
ds.from_self
|
|
59
|
+
.select(json_object_col)
|
|
60
|
+
.limit(1)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def collect_list(column)
|
|
64
|
+
Sequel.function(:collect_list, column)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class FunkyDuckDB < FunkyBase
|
|
70
|
+
|
|
71
|
+
def str_to_date(value, format, try: false)
|
|
72
|
+
strptime_func = try ? :try_strptime : :strptime
|
|
73
|
+
Sequel.function(strptime_func, Sequel.cast_string(value), to_strptime(format))
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def hash(*)
|
|
77
|
+
Sequel.function(:hash, concat(*)).then do |hash_val|
|
|
78
|
+
Sequel.case(
|
|
79
|
+
{ hash_val <= 9_223_372_036_854_775_807 => hash_val },
|
|
80
|
+
hash_val - 18_446_744_073_709_551_616,
|
|
81
|
+
).cast(:bigint)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def concat(*)
|
|
86
|
+
Sequel.function(:concat, *)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def make_json_column(ds, key_column, value_column)
|
|
90
|
+
json_object_col = Sequel.function(
|
|
91
|
+
:json_object,
|
|
92
|
+
key_column,
|
|
93
|
+
value_column,
|
|
94
|
+
).then do |json_object_col|
|
|
95
|
+
Sequel.function(
|
|
96
|
+
:list,
|
|
97
|
+
json_object_col,
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
ds.from_self
|
|
101
|
+
.select(json_object_col)
|
|
102
|
+
.limit(1)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def collect_list(column)
|
|
106
|
+
Sequel.function(:list, column)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def self.extended(db)
|
|
112
|
+
db.instance_exec do
|
|
113
|
+
@funky = get_funky(db.database_type)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def funky
|
|
118
|
+
@funky
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def get_funky(database_type)
|
|
122
|
+
case database_type
|
|
123
|
+
when :spark
|
|
124
|
+
FunkySpark.new(self)
|
|
125
|
+
when :duckdb
|
|
126
|
+
FunkyDuckDB.new(self)
|
|
127
|
+
else
|
|
128
|
+
raise "No known functions for #{database_type}"
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
Database.register_extension(:funky, Funky)
|
|
135
|
+
|
|
136
|
+
end
|