multidimensionāla datu analīze ar jruby

of 17/17
Multidimensionāla (Oracle un MySQL) datu analīze ar JRuby

Post on 18-May-2015

839 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

  • 1. Multidimensionla(Oracle un MySQL) datu analze ar JRuby

2. AgileOpen-TehnoloijassourceRuby Raimonds SimanovskisJavaScript github.com/[email protected] 3. Relacionlais datu modelis 4. SQL ir labs detaliztu datuatlasanai Atlast visas prdoanas transakcijas ASV, KalifornijSELECT customer.fullname, product.product_name,sales.sales_date, sales.unit_sales, sales.store_salesFROM salesLEFT JOIN products ON sales.product_id = products.idLEFT JOIN customers ON sales.customer_id = customers.idWHERE customers.country = USA AND customers.state_province = CA 5. SQL kst saretsanaltiskiem pieprasjumiem Kds ir prdoanas kopsavilkums ASV, Kalifornij, 2011. gada pirmaj kvartl pa galvenajm produktu grupmSELECT product_class.product_family, SUM(sales.unit_sales) unit_sales_sum, SUM(sales.store_sales) store_sales_sumFROM salesLEFT JOIN product ON sales.product_id = product.product_idLEFT JOIN product_class ON product.product_class_id = product_class.product_class_idLEFT JOIN time_by_day ON sales.time_id = time_by_day.time_idLEFT JOIN customer ON sales.customer_id = customer.customer_idWHERE time_by_day.the_year = 2011 AND time_by_day.quarter = Q1AND customer.country = USA AND customer.state_province = CAGROUP BY product_class.product_family 6. Multidimensionlaisdatu modelisMulti-dimensionli kubi (cubes)Dimensijas, hierarhijas un lmei(dimensions, hierarchies, levels)Mrjumi (measures) 7. OLAP tehnoloijasOn-Line Analytical Processing 8. MDX pieprasjumu valoda Kds ir prdoanas kopsavilkums 2011. gada pirmaj kvartl ASV, Kalifornij, pa galvenajm produktu grupmSELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON COLUMNS, [Product].children ON ROWS FROM [Sales] WHERE ([Time].[2011].[Q1], [Customers].[USA].[CA]) 9. http://github.com/rsim/mondrian-olap 10. (R)OLAP shmaDimensional model: cubes dimensions (hierarchies & levels) measures, calculated measures MappingRelational model: fact tables, dimension tables joined by foreign keys 11. OLAP shmasdefinanaschema = Mondrian::OLAP::Schema.define docube Sales dotable salesdimension Gender, :foreign_key => customer_id dohierarchy :has_all => true, :primary_key => customer_id dotable customerlevel Gender, :column => gender, :unique_members => trueendenddimension Time, :foreign_key => time_id dohierarchy :has_all => false, :primary_key => time_id dotable time_by_daylevel Year, :column => the_year, :type => Numeric, :unique_members => truelevel Quarter, :column => quarter, :unique_members => falselevel Month,:column => month_of_year,:type => Numeric,:unique_members => falseendendmeasure Unit Sales, :column => unit_sales, :aggregator => summeasure Store Sales, :column => store_sales, :aggregator => sumendend 12. Multidimensionlie pieprasjumi no RubyKds ir prdoanas kopsavilkums2011. gada pirmaj kvartlASV, Kalifornij,pa galvenajm produktu grupmolap.from(Sales).columns([Measures].[Unit Sales], [Measures].[Store Sales]).rows([Product].children).where([Time].[2011].[Q1], [Customers].[USA].[CA]) 13. Demo