Delete data based on date from DOMO - domo

I need to delete data from a dataset. I read this post that I think would help (https://dojo.domo.com/discussion/comment/46624#Comment_46624) but Im not sure where to run this query to delete from the table.
Please let me know if these are the correct steps:
click SQL in DOMO url -> MySQL -> input datasets (add the table I want to delete rows from) -> transform (
add my delete from statement:
DELETE FROM
my_table
where `loaded_date` >= '2019-10-01' and `loaded_date`<= '2019-11-01';)
-> output datasets (just do select * from table? does it matter what I enter here?, can I just limit to 10?)
thanks!

Ok so I found a way two ways to do this. Within my question I mentioned where to go to run a DataFlow, that would be one way to do this. But it matters what you write for the output dataset as that would be the new dataset you use.
So I did SELECT * FROM my_table;
The second way to do this is to delete the version history, so lets say I get my data daily to DOMO, I would go to the dataset url, and add this to the end: ?_f=dataRepair . This just refreshed the page, but at the top there is a new button to click on called "data repair" select that and it will take you to all your versions. You can filter it by date as well and just delete.

Related

Loop through database ANYLOGIC

In my model I want to loop through the database which contains multiple columns (see example) by an event. The idea behind it is that I want to create dynamic events based on the rows in the database.
But I've no clue how to iterate through a database in anylogic and also was not able to find an example of a loop with a database.
The dummycode of my problem would look something like this:
For order in orderdatabase:
Create order based on (order.name, order.quantity, order.arrivaltime, order.deliverylocation)
Where order in the loop is every row of the database, and the value on which the creation is based based on the different column values of that specific row.
Can somebody give me a simple example of how to create such a loop for this specific problem.
Thanks in advance.
Use the database query wizard:
put your cursor into a code field
this will allow you to open the database wizard
select what you need (in your case, you want the "iterate over returned rows and do something" option
Click ok
adjust the dummy code to make it do what you want
For details and examples, check the example models and the AnyLogic help, explaining all options in detail.

How to filter dashboard based on quick filter values selected in Tableau ?

I'm having Dashboard-1 with the data source from SQL Server Table-A having columns
Col1,Col2,Col3
Now, i'm creating a new dashboard-2 with data source as Table-B having columns Col1,Col4,Col5.
But Col1 which is common in both these tables doesn't have common data.
Eg. Col1 from Table-A is having records till 100 and Table-B is having records from 101.Also, the data is not static, its keeps on increasing in Table-B , Table-A is no longer populating but we need the data from it.
Problem1-- How to merge two column as single column for filter in Tableau
Problem2-- in the dashboard i need to show single filter as a union of Col1 from both tables, if user select value <100 then Dashboard-1 will open otherwise Dashboard-2.
Can someone provide me a correct approach.
1) Instead of merging after you have brought the data in, try merging the data using SQL UNION.
2) If that's not possible, do the same after importing both the datasets into Tableau. For an example, try from this official link
3) Try different Joins to see which one works for merging your table columns:
4) If all the above fails, try setting up an Action Filter explained in this link. Essentially you have to use Tiled Containers instead of Floating Containers and set up a action filter using a custom Parameter. This custom Parameter will help display Dashboard 1 when user selects <100 in the filter(for example) and Dashboard 2 when user selects >100(again example)

Copy Data - How to skip Identity columns

I'm designing a Copy Data task where the Sink SQL Server table contains an Identity column. The Copy Data task always wants me to map that column when, in my opinion, it should just not include the column in the list of columns to map. Does anyone know how I can get the ADF Copy Data task to ignore Sink Identity columns?
If you are using copy data tool, and in your sql server, the ID is set as auto-increment, then it should not show out at the mapping step. Please tell us if it is not the case.
If you are using the create pipeline/dataset, you could just go to the sink dataset schema tab, remove the id column. And then go to the copy activity mapping tab, click import schemes again. ID column should has disappeared now.
You could include a SET_IDENTITY_INSERT_ON statement for the given table before executing the copy step. After completed, set it to OFF.

How to know in Talend if tMySQLInput will overwrite data?

I have one already existing Talend Open Studio tMySQLInput component with some sql code inside it, in order to retrieve some joined columns linked to a tMySQLOuput component (pointing to an already existing MySQL table) with few records.
QUESTION:
Will the "tMySQLInput" component overwrite the already existing table data that the tMySQLOutput component relates to? I mean is there an option to check in the tMySQLInput our output in order to say, overwrite each time this job is executed ?
Thank you all.
Yes, there is an option where in tMySQLOutput where you can specify what action you want to do to your table. Follow following steps:
Go to component tab of tMySQLOutput, it will open the basic settings of this component.
If you will look closer you will find Action on table. This is the action which you can perform on the table which is pointed by tMySQLOutput. It has options as Default, Drop and Create Table etc.
Then you have Action on data. These are the options which you can perform on the data like Insert, Update etc.
In your case I suppose you can choose Action on Table as Default and Action on Data as Insert. Default action would not do anything on the table and Insert option would insert the records at the end of table. But in case of Insert if you will have duplicate rows then job would stop the moment it will find any duplicate row.

How can I query the results of a query in Server Explorer in Visual Studio?

I can get the results of a Stored Proc from Visual Studio by following these steps:
0) Select View > Server Explorer
1) Locate the Data Connection that contains the SP of interest.
2) Right-click the SP and select Execute; if any args are required, it will allow you to populate those in a dialog and then proceed with the execution
Provided that you have provided valid args (and the SP returns data), the results will display in a grid in a T-SQL Results tab.
Now, though, what if you want to query that "dataset" that has been returned, such as to sum the values of a particular column - can that be done right there from within Visual Studio.Server Explorer.T-SQL? If so, how?
UPDATE
I believe Khazratbek, but I can only get this far in a New Query instantiated by right-clicking the Tables folder beneath the Data Connection:
SELECT SUM(QtyShipped), SUM(QtyOrdered) FROM CPSData.
...the options available as a drop down following that final "." do not contain the results of the Stored Proc (SQLQuery1.sql).
Is it really possible?
Server Explorer -. Right click on Tables -> New query. Write your query (you may select from your SP execution results) and just click on triangle sign. Sorry, if I misunderstand your exact question.
Let's think that your stored procedures gives you logins and passwords of users:
select login, password from users;
You are taking one million result, for example. And you don't need to change your stored procedure, but you want to make some job with your results (selecting in some order, changing the order, select by some condition, so on).
Let's continue. Your stored procedure gives you a two column: it is column login and password. So we may consider the results of your SP execution as some table. To work with your result do next steps:
Server Explorer -> Your_database_connection -> Right click on Tables -> New query
Then write the following code there:
Declare #temporary_table_variable table(login varchar, password varchar); --or without datatypes
insert into #temporary_table_variable(login, password) exec MyStoredProc;
SELECT * from #temporary_table_variable where id > 1000; --it is just a simple example
Hope it helps