Hello @Anmol Ganju ,
Thanks for the ask and using Microsoft Q&A platform .
As I understand the goal here is to load a few columns from the paraquet file to SQLDW .
At this time when we have a source as paraquet file , there is no way we can have a query option in which you only select few rows . We can achieve something similar by altering the mapping , but then since you have 20 table i think we can do the below implamentation . I have tested that and it should work .
Steps
- Lets have all the records from paraquet file flow to SQLDW to some _stg ( staging table ) . I think you have already implemented this . In my case the dbo.flightData_stg column has 3 columns but the table dbo.flightData will have only one column .
- Lets use a Foreach activity and pass the table names like
- We will use a query in the SQL like
select STRING_AGG(name,',') as columnName from sys.syscolumns
where id =object_id('dbo.flightData');
to get all the columns for the table in the where clause
We will use a dynamic expression like ( i will upload the dynamic expression as a text file )
@markus.bohland@hotmail.de ('SELECT STRING_AGG(name,''', ',',''') as columnName from sys.syscolumns where id =object_id(''', first(split(item(),'_')) ,'''' ,')' )
In my implementation I have used a variable name to contruct the expression , i find this very helpful for debugging
- Pull up a Lookup activity and pass on the dynamic expression . The Lookup will return the column name of the actual table ( not _stg table )
- We will use a set variable for constructing the query ( with few columns ) the We will use a dynamic expression where we got the column name ( of the target table in our case flightData ) . The aim is to construct a dynamic query like . This is only used for debuging ( if you want we can remove this activity )
SELECT col1,col2 FROM flightData_stg
@markus.bohland@hotmail.de ( 'SELECT ' , activity('ColumnNamefromDB').output.firstRow.columnName , ' FROM ' , item())
6 . Add a copy activity and we will use paramterized data , I think you may already used that in the initla implemenation .
Source Query
@markus.bohland@hotmail.de ( 'SELECT ' , activity('ColumnNamefromDB').output.firstRow.columnName , ' FROM ' , item())
on the destination ( tables name are parameterized )
Please use the dynamic expression
@last lion (split(first(split(item(),'_')),'.'))
The above expression will derieve the actual table name dbo.flightData from the staging table dbo.flightData_stg which we have a passed as an array ( image 1 on this reply )
166603-dynamic-expression.txt
<<Continued below >>.
Thanks
Himanshu
- Please don't forget to click on or upvote button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
- Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators