etl

“pivot” table Oracle - how to change row items into columns

纵然是瞬间 提交于 2019-11-28 02:30:03
I have the following simple example: CREATE TABLE Cars ( Cars, Item, Value ) AS SELECT 'bmw', 'wheels', '4' FROM DUAL UNION ALL SELECT 'bmw', 'color', 'red' FROM DUAL UNION ALL SELECT 'bmw', 'price', '5' FROM DUAL UNION ALL SELECT 'mercedes', 'wheels', '4' FROM DUAL UNION ALL SELECT 'mercedes', 'color', 'black' FROM DUAL UNION ALL SELECT 'lambo', 'wheels', '5' FROM DUAL UNION ALL SELECT 'lambo', 'color', 'yellow' FROM DUAL UNION ALL SELECT 'lambo', 'price', '7' FROM DUAL UNION ALL SELECT 'mercedes', 'price', '6' FROM DUAL; The thing is that I need to "pivot" the table to get items as column

Reading Huge volume of data from Sqlite to SQL Server fails at pre-execute

牧云@^-^@ 提交于 2019-11-28 02:15:16
I have a huge (26GB) sqlite database that I want to import to SQL Server with SSIS. I have everything setup correctly. Some of the data flows are working correctly and importing the data. Data flows are simple. They just consist of source and destination. But when it comes to a table that has 80 million rows, data flow fails with this unhelpful message: Code: 0xC0047062 Source: Data Flow Task Source 9 - nibrs_bias_motivation [55] Description: System.Data.Odbc.OdbcException (0x80131937): ERROR [HY000] unknown error (7) at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode

SSIS ragged file not recognized CRLF

心已入冬 提交于 2019-11-28 01:32:32
In SSIS, I try to load data from a flat file. The flat file have fixed width columns, but some column are not present in a row (a column can have a CRLF, which must be a new line) like this a b c the first rowok<CRLF> iu jjrjdd<CRLF> this is a newline<CRLF> How I can have exactly the same number of line and exact data in my output ? I setup a flat file connection, of ragged right type. In this sample, row 1 is correctly retrieve, but for row 2, it didn't recognize CRLF, and put in b column all the 3rd row ... thanks in advance Regards, Xavier Workaround In the flat file connection manager read

Query a database based on result of query from another database

半腔热情 提交于 2019-11-28 00:12:30
问题 I am using SSIS in VS 2013. I need to get a list of IDs from 1 database, and with that list of IDs, I want to query another database, ie SELECT ... from MySecondDB WHERE ID IN ({list of IDs from MyFirstDB}) . 回答1: There is 3 Methods to achieve this: 1st method - Using Lookup Transformation First you have to add a Lookup Transformation like @TheEsisia answered but there are more requirements: In the Lookup you Have to write the query that contains the ID list (ex: SELECT ID From MyFirstDB

How do I split flat file data and load into parent-child tables in database?

大憨熊 提交于 2019-11-28 00:07:01
I have denormalized data (coming from a file) that needs to be imported into parent-child tables. The source data is something like this: Account# Name Membership Email 101 J Burns Gold alpha@foo.com 101 J Burns Gold bravo@foo.com 101 J Burns Gold charlie@yay.com 227 H Gordon Silver red@color.com 350 B Clyde Silver italian@food.com 350 B Clyde Silver mexican@food.com What are the pieces, parts, or tactics of SSIS I should use to read the first three columns into a parent table, and the 4th column (Email) into a child table? I have several options for the parent key which I am permitted to take

SSIS - How to access a RecordSet variable inside a Script Task

谁都会走 提交于 2019-11-27 23:30:04
How do you access a RecordSet variable inside a Script Task? On the script tab, make sure you put the variable in either the readonlyvariables or readwritevariables text boxes. Here is a simple script that I use to format the errors in a data flow (saved in a RecordSet Variable) into the body of an email. Basically I read the recordset varialbe into a datatable and process it row by row with the for loops. After this task completes I examine the value of uvErrorEmailNeeded to determine if there is anything to email using a conditional process flow connector. You will also need to add a

Using Pentaho Kettle, how do I load multiple tables from a single table while keeping referential integrity?

柔情痞子 提交于 2019-11-27 19:46:36
Need to load data from a single file with a 100,000+ records into multiple tables on MySQL maintaining the relationships defined in the file/tables; meaning the relationships already match. The solution should work on the latest version of MySQL, and needs to use the InnoDB engine; MyISAM does not support foreign keys. I am a completely new to using Pentaho Data Integration (aka Kettle) and any pointers would be appreciated. I might add that it is a requirement that the foreign key constraints are NOT disabled. Since it's my understanding that if there is something wrong with the database's

How to convert result table to JSON array in MySQL

假装没事ソ 提交于 2019-11-27 18:46:20
I'd like to convert result table to JSON array in MySQL using preferably only plain MySQL commands. For example with query SELECT name, phone FROM person; | name | phone | | Jack | 12345 | | John | 23455 | the expected JSON output would be [ { "name": "Jack", "phone": 12345 }, { "name": "John", "phone": 23455 } ] Is there way to do that in plain MySQL? EDIT: There are some answers how to do this with e.g. MySQL and PHP , but I couldn't find pure MySQL solution. New solution: Built using Your great comments, thanks! SELECT JSON_ARRAYAGG(JSON_OBJECT('name', name, 'phone', phone)) from Person;

数据仓库建模与ETL实践技巧

不想你离开。 提交于 2019-11-27 16:17:22
一、数据仓库的架构 数据仓库(Data Warehouse DW)是为了便于多维分析和多角度展现而将数据按特定的模式进行存储所建立起来的关系型数据库,它的数据基于OLTP源系统。数据仓库中的数据是细节的、集成的、面向主题的,以OLAP系统的分析需求为目的。 数据仓库的架构模型包括了星型架构(图二:pic2.bmp)与雪花型架构(图三:pic3.bmp)两种模式。如图所示,星型架构的中间为事实表,四周为维度表,类似星星;而相比较而言,雪花型架构的中间为事实表,两边的维度表可以再有其关联子表,从而表达了清晰的维度层次关系。 从OLAP系统的分析需求和ETL的处理效率两方面来考虑:星型结构聚合快,分析效率高;而雪花型结构明确,便于与OLTP系统交互。因此,在实际项目中,我们将综合运用星型架构与雪花型架构来设计数据仓库。 那么,下面我们就来看一看,构建企业级数据仓库的流程。 二、构建企业级数据仓库五步法 (一)、确定主题 即确定数据分析或前端展现的主题。例如:我们希望分析某年某月某一地区的啤酒销售情况,这就是一个主题。主题要体现出某一方面的各分析角度(维度)和统计数值型数据(量度)之间的关系,确定主题时要综合考虑。 我们可以形象的将一个主题想象为一颗星星:统计数值型数据(量度)存在于星星中间的事实表;分析角度(维度)是星星的各个角;我们将通过维度的组合,来考察量度。那么,

SSIS reading LF as terminator when its set as CRLF

╄→尐↘猪︶ㄣ 提交于 2019-11-27 15:37:54
using SSIS 2012. My flat file connection manager I have a delimited file where the row delimiter is set to CRLF , but when it processes the file, I have a text column that has an LF in it. This is causing it to read that as a row terminator causing it fail. Any ideas? Before answering, i don't think that the column contains only LF because if the row delimiter is CRLF it will not consider it as delimiter. So it is probably CRLF , but i will give a solution for the two cases (CRLF or LF) Solution You can fix this situation with the following steps: First in the Flat File connection manager add