ran_a_lytics 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +33 -0
- data/lib/ran_a_lytics/version.rb +1 -1
- data/ran_a_lytics.gemspec +1 -1
- metadata +43 -4
data/README
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Ruby Analytics or Ran_A_Lytics is an ActiveRecord extension that provides simple yet effective pivoting of pure Ansi92 SQL though MySQL and Infobright. Though it is not required to pivot a query of an Infobright database, the heavy cost of aggregates in analytical make it impractical to pivot large datasets of INNODB or MYISAM stored data. You can check out a demo or the community edition of Infobright by going to http://www.infobright.org.
|
2
|
+
|
3
|
+
Quickstart
|
4
|
+
1) Follow the instructins on setting up an Infobright MySQL instance
|
5
|
+
2) Grab the sample database from http://bit.ly/gBQnaD
|
6
|
+
|
7
|
+
# -*- encoding: utf-8 -*-
|
8
|
+
$:.push File.expand_path("../lib", __FILE__)
|
9
|
+
require 'rubygems'
|
10
|
+
require 'ran_a_lytics'
|
11
|
+
require 'active_record'
|
12
|
+
require 'time'
|
13
|
+
puts "Gathering data"
|
14
|
+
#Connect to a database
|
15
|
+
ActiveRecord::Base.establish_connection(
|
16
|
+
:adapter => "mysql",
|
17
|
+
:host => "localhost",
|
18
|
+
:username => "root",
|
19
|
+
:password => "",”
|
20
|
+
:database => "carsales",
|
21
|
+
:socket => "/tmp/mysql-ib.sock"
|
22
|
+
|
23
|
+
class FactSalesWide < ActiveRecord::Base
|
24
|
+
set_table_name "fact_sales_wide"
|
25
|
+
make_pivotable
|
26
|
+
end
|
27
|
+
|
28
|
+
#Pivot a query for 10,000 rows into car_make rows, by transaction types columns for two measures
|
29
|
+
starttime = Time.now
|
30
|
+
ma = FactSalesWide.PivotTable(:columns=> ['dlr_trans_type as Transaction'],:rows=>['dim_cars.make_name as make'],:measures=>['sum(sales_commission) as sum_sales_commission', 'sum(sales_discount) as sum_sales_discount'], :joins => ['JOIN dim_cars ON fact_sales_wide.make_id = dim_cars.make_id'])
|
31
|
+
endtime = Time.now
|
32
|
+
puts ma.to_json
|
33
|
+
|
data/lib/ran_a_lytics/version.rb
CHANGED
data/ran_a_lytics.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = "Robert Hall"
|
10
10
|
s.email = "robert.hall@itatc.com"
|
11
|
-
s.homepage = "http://github.com/golsombe/
|
11
|
+
s.homepage = "http://github.com/golsombe/Ran_a_lytics"
|
12
12
|
s.summary = "An Infobright compainion Rails extention"
|
13
13
|
s.description = "Providing analytics as a DSL to an InfobrightCE database"
|
14
14
|
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ran_a_lytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Robert Hall
|
@@ -21,6 +26,11 @@ dependencies:
|
|
21
26
|
requirements:
|
22
27
|
- - ">="
|
23
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
- 0
|
24
34
|
version: 3.0.0
|
25
35
|
type: :runtime
|
26
36
|
version_requirements: *id001
|
@@ -32,6 +42,11 @@ dependencies:
|
|
32
42
|
requirements:
|
33
43
|
- - ">="
|
34
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 0
|
49
|
+
- 0
|
35
50
|
version: 1.0.0
|
36
51
|
type: :development
|
37
52
|
version_requirements: *id002
|
@@ -43,6 +58,11 @@ dependencies:
|
|
43
58
|
requirements:
|
44
59
|
- - ">="
|
45
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 0
|
65
|
+
- 0
|
46
66
|
version: 2.0.0
|
47
67
|
type: :development
|
48
68
|
version_requirements: *id003
|
@@ -54,6 +74,11 @@ dependencies:
|
|
54
74
|
requirements:
|
55
75
|
- - "="
|
56
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 15
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
- 5
|
81
|
+
- 2
|
57
82
|
version: 0.5.2
|
58
83
|
type: :development
|
59
84
|
version_requirements: *id004
|
@@ -65,6 +90,11 @@ dependencies:
|
|
65
90
|
requirements:
|
66
91
|
- - ">="
|
67
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 45
|
94
|
+
segments:
|
95
|
+
- 2
|
96
|
+
- 8
|
97
|
+
- 1
|
68
98
|
version: 2.8.1
|
69
99
|
type: :development
|
70
100
|
version_requirements: *id005
|
@@ -81,6 +111,7 @@ files:
|
|
81
111
|
- ":dev"
|
82
112
|
- Gemfile
|
83
113
|
- Gemfile.lock
|
114
|
+
- README
|
84
115
|
- Rakefile
|
85
116
|
- lib/ran_a_lytics.rb
|
86
117
|
- lib/ran_a_lytics/pivot.rb
|
@@ -89,7 +120,7 @@ files:
|
|
89
120
|
- ran_a_lytics.komodoproject
|
90
121
|
- ran_a_lytics.kpf
|
91
122
|
has_rdoc: true
|
92
|
-
homepage: http://github.com/golsombe/
|
123
|
+
homepage: http://github.com/golsombe/Ran_a_lytics
|
93
124
|
licenses: []
|
94
125
|
|
95
126
|
post_install_message:
|
@@ -102,17 +133,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
133
|
requirements:
|
103
134
|
- - ">="
|
104
135
|
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 0
|
105
139
|
version: "0"
|
106
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
141
|
none: false
|
108
142
|
requirements:
|
109
143
|
- - ">="
|
110
144
|
- !ruby/object:Gem::Version
|
145
|
+
hash: 23
|
146
|
+
segments:
|
147
|
+
- 1
|
148
|
+
- 3
|
149
|
+
- 6
|
111
150
|
version: 1.3.6
|
112
151
|
requirements: []
|
113
152
|
|
114
153
|
rubyforge_project: ran_a_lytics
|
115
|
-
rubygems_version: 1.
|
154
|
+
rubygems_version: 1.3.7
|
116
155
|
signing_key:
|
117
156
|
specification_version: 3
|
118
157
|
summary: An Infobright compainion Rails extention
|