raka 0.3.13 → 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/raka/lang/psql/impl.rb +8 -7
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7433868304f673611a2ce9b5e847a8a78cd6bbd0be86fe18d576090acf7009f
4
- data.tar.gz: ebe65786208dfd8bf1e35ea83a6ad625279018aa3a73df14599392bbaa91d684
3
+ metadata.gz: ab9b8b30524daa0207aac3bfb90d9006490788c0384804712c05ce95000ea633
4
+ data.tar.gz: 2f78b17b036bd4ecb11bc03ffa75e800049efa2b946f5f39432a4a64e22a628d
5
5
  SHA512:
6
- metadata.gz: d8498aa76cd3a4ec7277fb0d7e7618c030c70cab306258bec7b5806c0da249108943e56f2b78bf41eb9fddc54d0f0aada4cfb21e59abca81db5dc8fc7495f18c
7
- data.tar.gz: 7eef06176d02da633b5fc2138d675ec66809f479a84e155800f25d6797ed0aa463a58d76a77d1540d1d6b9eb8c6abfed39d60f78881344634cbd37610fdae579
6
+ metadata.gz: a0a501811a98b26562bc435a9be601e5f501032b37bc7f8b48eb1308e45d98c462332d2f5b13b083a3b2bd6b8b864cc0389426cc3a29d26c9826ddc7e9560af6
7
+ data.tar.gz: 562812715b0171702059cfc246e6af7984a3091601b63608c062807ee93697778e8bff36ed399e5e10418bda1378daee9438e0fcc315966be31d63c56c6f2bff
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.13
1
+ 0.3.15
@@ -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
 
@@ -35,11 +36,11 @@ class Psql
35
36
  raise 'argument conn required' if @conn.nil?
36
37
 
37
38
  if @create.to_s == 'table'
38
- 'DROP TABLE IF EXISTS :_schema_.:_name_;' \
39
- 'CREATE TABLE :_name_ AS (' + code + ');'
39
+ 'DROP TABLE IF EXISTS :_schema_:_name_;' \
40
+ 'CREATE TABLE :schema:_name_ AS (' + code + ');'
40
41
  elsif @create.to_s == 'mview'
41
- 'DROP MATERIALIZED VIEW IF EXISTS :_schema_.:_name_;' \
42
- 'CREATE MATERIALIZED VIEW :_name_ AS (' + code + ');'
42
+ 'DROP MATERIALIZED VIEW IF EXISTS :_schema_:_name_;' \
43
+ 'CREATE MATERIALIZED VIEW :schema:_name_ AS (' + code + ');'
43
44
  else
44
45
  code
45
46
  end
@@ -47,11 +48,11 @@ 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} \
54
- -v _schema_=#{schema} -f #{fname} | tee #{fname}.log
55
+ -v _schema_=#{schema.empty? ? '' : schema + '.'} -f #{fname} | tee #{fname}.log
55
56
  mv #{fname}.log #{task.name}
56
57
  )
57
58
  end
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.13
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: 2022-06-27 00:00:00.000000000 Z
11
+ date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake