raka 0.3.14 → 0.3.15
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/VERSION +1 -1
- data/lib/raka/lang/psql/impl.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab9b8b30524daa0207aac3bfb90d9006490788c0384804712c05ce95000ea633
|
4
|
+
data.tar.gz: 2f78b17b036bd4ecb11bc03ffa75e800049efa2b946f5f39432a4a64e22a628d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0a501811a98b26562bc435a9be601e5f501032b37bc7f8b48eb1308e45d98c462332d2f5b13b083a3b2bd6b8b864cc0389426cc3a29d26c9826ddc7e9560af6
|
7
|
+
data.tar.gz: 562812715b0171702059cfc246e6af7984a3091601b63608c062807ee93697778e8bff36ed399e5e10418bda1378daee9438e0fcc315966be31d63c56c6f2bff
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.15
|
data/lib/raka/lang/psql/impl.rb
CHANGED
@@ -24,9 +24,10 @@ class Psql
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# 1. do not add required argument here, so psql.config will work or we can only use psql(conn: xxx).config
|
27
|
-
def initialize(conn: nil, create: 'mview', params: {})
|
27
|
+
def initialize(conn: nil, create: 'mview', schema: '', params: {})
|
28
28
|
@create = create
|
29
29
|
@params = params
|
30
|
+
@schema = schema
|
30
31
|
@conn = conn
|
31
32
|
end
|
32
33
|
|
@@ -36,10 +37,10 @@ class Psql
|
|
36
37
|
|
37
38
|
if @create.to_s == 'table'
|
38
39
|
'DROP TABLE IF EXISTS :_schema_:_name_;' \
|
39
|
-
'CREATE TABLE :_name_ AS (' + code + ');'
|
40
|
+
'CREATE TABLE :schema:_name_ AS (' + code + ');'
|
40
41
|
elsif @create.to_s == 'mview'
|
41
42
|
'DROP MATERIALIZED VIEW IF EXISTS :_schema_:_name_;' \
|
42
|
-
'CREATE MATERIALIZED VIEW :_name_ AS (' + code + ');'
|
43
|
+
'CREATE MATERIALIZED VIEW :schema:_name_ AS (' + code + ');'
|
43
44
|
else
|
44
45
|
code
|
45
46
|
end
|
@@ -47,7 +48,7 @@ class Psql
|
|
47
48
|
|
48
49
|
def run_script(env, fname, task)
|
49
50
|
param_str = (@params || {}).map { |k, v| "-v #{k}=\"#{v}\"" }.join(' ')
|
50
|
-
schema = task.rule_scopes.join('__')
|
51
|
+
schema = @schema.empty? ? task.rule_scopes.join('__') : @schema
|
51
52
|
|
52
53
|
bash env, %(
|
53
54
|
#{sh_cmd(schema)} #{param_str} -v _name_=#{task.output_stem} \
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yarray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|