Cannot rename table because it is referenced by pipeline `fdext` - singlestore

I am getting below error when i am trying to rename my table in singlestore .how to fix it?
ERROR 1945 ER_CANNOT_DROP_REFERENCED_BY_PIPELINE: Cannot rename table
because it is referenced by pipeline fdext

One of your pipeline in SingleStore is ingesting data into this table so you can not rename the table because the pipeline will try to insert data into the previous one.
Unfortunately you can't alter pipeline to target a different table.
So here is the sequence to do it :
SHOW CREATE PIPELINE <your_pipeline> EXTENDED; - save the pipeline
settings, including the ALTER PIPELINE lines
STOP PIPELINE <your_pipeline>; - stop the pipeline
DROP PIPELINE <your_pipeline>; - delete the pipeline
ALTER TABLE <new_table> RENAME TO <old_name>; - rename your table
Recreate the pipeline with the settings collected at step 1 and change table name to the new one
START PIPELINE <your_pipeline>; - start the pipeline

Related

Skip null rows while reading Azure Data Factory

I am new to Azure Data Factory, and I currently have the following setup for a pipeline.
Azure Data Factory Pipeline
Inside the for each
The pipeline does the following:
Reads files for a directory everyday
Filters the children in the directory based on file type [only selects TSV files]
Iterates over each file and copies the data to Azure Data Explorer if they have the correct schema, which I have defined in mapping for the copy activity.
It copied files are then moved to a different directory and deleted from the original directory so that they aren't copied again.
[Question]: I want to delete or skip the rows which have null value in any one of the attributes.
I was looking into using data flow, but I am not sure how to use data flows to read multiple tsv files and validate their schema before applying transformations to delete the null records.
Please let me know if there is a solution where I can skip the null values in the for each loop or if I can use data flow to do the same.
If I can use data flow, how do I read multiple files and validate their column names (schema) before applying row transformations?
Any suggestions that would help me delete or skip those null values will be hugely helpful
Thanks!
Ok, inside the ForEach activity, you only need to add a dataflow activity.
The main idea is to do the filter/assert activity then you write to multiple sinks.
ADF dataflow :
Source:
add your tsv file as requested, and make sure to select in After completion ->Delete source files this will save you from adding a delete activity.
Filter activity:
Now, depends on your use case, do you want to filter rows with null values? or do you want to validate that you don't have null values.
if you want to filter, just add a filter activity, in filter settings -> filter on -> 'here add your condition'.
if you need to validate rows and make the dataflow fail, use the assert activity
filter condition : false(isNull(columnName))
Sink:
i added 2 sinks,one for ADE and one for new directory.
You can read more about it here:
https://learn.microsoft.com/en-us/azure/data-factory/data-flow-assert
https://learn.microsoft.com/en-us/azure/data-factory/data-flow-filter
https://microsoft-bitools.blogspot.com/2019/05/azure-incremental-load-using-adf-data.html
please consider the incremental load and change the dataflow accordingly.

Cannot copy data from azure data lake gen2 to azure sql db using data factory pipeline

Failure happened on 'Sink' side. ErrorCode=UserErrorInvalidColumnName,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The column Prop_0 is not found in target side,Source=Microsoft.DataTransfer.ClientLibrary.
All the part files in the ADLS GEN2 have 8 columns and the sink table also has 8 columns and there is no such column called Prop_0 in part files.
Inputs are part files saved in ADLS GEN2 -
Content of one of the part file -
Mapping on ADF -
Output of sql query executed on Azure query editor -
You get this error when your source files don’t have a header (or consider first row as header when you have a header for source files) and you have not enabled the column mapping option. Prop_0, Prop_1 etc., will act as column names when the source file does not have a header (or not enabled).
In this case, when you disable the column mapping option (cleared or skipped), the copy activity will try to insert columns from source using the name, only when they match your sink (table). In the following image, I have not imported the schema (skipped) and it throws the same error when I run the pipeline.
Since your destination does not have Prop_0 column, it throws the following error:
Follow the steps specified below to rectify this error:
First identify if your source part files have header. Then edit your source dataset by checking/unchecking the first row as header option. Publish and preview this data in the source tab of your pipeline.
Move to Mapping section and click import schemas (Clear and import again if required). Make changes in the mapping if necessary, according to your requirements.
Changes have to be made in this mapping because the source columns and the destination columns don't match. From the part file sample you have given, the appropriate mapping would be as shown below:
Now run the pipeline. The pipeline will run successfully and the sql table will reflect the rows inserted.

ADF to Snowflake incremental load and streams

I am trying to load files from my Azure blob to Snowflake table incrementally. After which in snowflake, I put streams on that table and load the data to the target table.
I am unable to do incremental load from Azure to Snowflake. I have tried many ways but not working. I am attaching the images of my 2 different ways (pipelines) to do the same.
In this pipeline, I just added 3 extra columns which I wanted in my sink
In this pipeline, I tried creating conditional splits
Both of these have not worked out.
Kindly suggest me how to go about this.
You can achieve this by selecting Allow Upsert in sink settings under the Update method.
Below are my repro details:
This is the staging table in snowflake which I am loading incremental data to.
Source file – Incremental data
a) This file contains records that exist in the staging table (StateCode = ‘AK’ & ‘CA’), so these 2 records should be updated in the staging table with new values in Flag.
b) Other 2 records (StateCode = ‘FL’ & ‘AZ’) should be inserted into the staging table.
Dataflow source settings:
Adding DerivedColumn transformation to add a column modified_date which is not in the source file but in the sink table.
Adding AlterRow transformation: When you are using the Upsert method, AlterRow transformation is a must to include the upsert condition.
a) In condition, you can mention to upsert the rows only when the unique column (StateCode in my case) is not null.
Adding sink transformation to AlterRow with Snowflake stage table as sink dataset.
a) In sink settings, select Update method as Allow upsert and provide the Key (unique) column based on which the Upsert should happen in sink table.
After you run the pipeline, you can see the results in a sink.
a) As StateCode AK & CA already exists in the table, only other column values (flag & modified_date) for those rows are updated.
b) StateCode AZ & FL are not found in the stage (sink) table so, these rows are inserted.

Adf Copy task with Excel in a foreach loop

within Azure Adf, I have an excel file with 4 tabs named Sheet1-Sheet4
I would like to loop through the excel creating a CSV per tab
I have created a SheetsNames parameter in the pipeline with a default value of ["Sheet1","Sheet2","Sheet3","Sheet4"]
How do I use this with the copy task to loop with the tabs?
Please try this:
Create a SheetsNames parameter in the pipeline with a default value of ["Sheet1","Sheet2","Sheet3","Sheet4"].
Add a For Each activity and type #pipeline().parameters. SheetsNames in the Items option.
Within the For Each activity, add a copy activity.
Create Source dataset and create a parameter named sheetName with empty default value.
Navigate to the Connection setting of the Source dataset and check Edit in the Sheet name option. Then type #dataset().sheetName in it.
Navigate to the Source setting of the Copy data activity and pass #item() to the sheetName.
Create a Sink dataset and it's setting is similar to the Source dataset.
Run the pipeline and get this result:

ADF Delta Copy Activity fails, delete partly copied file from data lake

I have a hourly delta load pipeline in that i have a copy activity to copy data from sql server to datalake parquet format with folder structure (YY/MM/DD/table_nameHH) in For each activity:
after copy activity i have success/failure procedure to update records in control table
i need to ensure if any copy activity failed in between i need to remove that partly copied file from data lake. how to put that condition to pickand delete that dynamic file in my pipeline.
Thanks in Advance
p.s i am pretty new to this tool and learning daily.
Please ref these steps bellow:
You could add an If condition behind the Copy_DimCustomer_AC active:
In If condition expressions, build the expression to judge if Copy_DimCustomer_AC.executionDetails.status equals "Succeeded", if ture, then the copy active succeeded:
#equals(activity('Copy_Dimcustomer_AC').output.executionDetails.status,'Succeeded')
True actives:
False active: add a delete active to delete the file and run the Log_failure_status_AC:
HTH.

Resources