wvanbergen / active_olap Goto Github PK
View Code? Open in Web Editor NEWOLAP extensions for ActiveRecord
Home Page: http://wiki.github.com/wvanbergen/active_olap
License: MIT License
OLAP extensions for ActiveRecord
Home Page: http://wiki.github.com/wvanbergen/active_olap
License: MIT License
When a date trend or time dimension is used and there is no data you get and sql error.
Line 65 of dimension.rb:
"CASE #{whens.join(' ')} ELSE NULL END AS #{@klass.connection.send(:quote_column_name, variable_name)}";
returns:
CASE ELSE NULL END AS "dimension_0"
Which is invalid. Might want to add a check for the "whens" variable on like 64.
If you run an olap query with a :joins, the 'id' column will be considered ambiguous. You need to prepend the table name to the front of the column for each dimension. In dimension.rb, line 58, add the @klass.connection.send(:quote_table_name, @klass.table_name) + '.' + to the beginning of the column name:
def to_case_expression(variable_name)
if @category_field
@klass.connection.send(:quote_table_name, @klass.table_name) + '.' +
"#{@klass.connection.send(:quote_column_name, @category_field)} AS #{@klass.connection.send(:quote_column_name, variable_name)}"
else
whens = @categories.map { |category| @klass.send(:sanitize_sql, ["WHEN (#{category.to_sanitized_sql}) THEN ?", category.label.to_s]) }
"CASE #{whens.join(' ')} ELSE NULL END AS #{@klass.connection.send(:quote_column_name, variable_name)}";
end
end
You'll probably want to implement a more robust solution though.
Hey Willem,
tried to use your plugin, but when doing on a simple model Ping, it raised an exception on
pings
.* FROM pings
WHERE (((>= '2009-11-22 00:00:00' AND
< '2009-11-23 00:00:00') AND ((>= '2009-11-21 00:00:00' AND
< '2009-12-05 00:00:00'))))enable_active_olap do |olap|
# Easily create a trend dimension
olap.dimension :created_daily, :trend => {
:timestamp_field => :created_at,
:period_length => 1.day,
:period_count => 20
}
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.