How to check why events_intraday_ table has not moved to events_ in bigquery? - google-bigquery

My table for yesterday is still showing up in events_intraday_ along with table for today (this is expected behavior).
I've tried to look around for answers and the only thing I could find was if there is an error in exporting the table to events_ from events_intraday_, then my situation can happen.
My question is how do I find out "what" is wrong? is there any place where I can see logs or something similar?

Related

Dynamic Alert Process

I am after advice more than I direct answer or if someone has done something similar. I will try and explain what I want to do. I am want to create a SQL a stored procedure that checks against table and dynmically runs the code that is situate in one of the fields, something similar to SQL Alerts but I dont want to create lots of alerts. My table would have something like an Alert Name field and a piece of code that checks to see if an order has been put in a table for over £150 as an example, there will be lots of other similar small pieces of code. This table would be linked to another that dictates how often it runs depending on the time of day then a futher table that says what happens when the alert is triggered, a stage one alert would be an email a stage 2 would be a text. I then have a stored procedure that runs constantly checking the necessary tables to see if anything needs to be run. I appreciate this might be a little vague for a direct answer but if anyone could offer some advice that would be much appreciated.
Hi DMason/Others, sorry I was typing that out a little late last night and yep vagueness seemed to be the order of the day ;) I am trying to put together a custom alert system that uses a Stored procedure to analyse a table to see if an alert is scheduled and then run it. Right I have a table that contains 2 columns Name and Code, Name is just a piece of text and Code will contain a basic select statement as an example. I then have a table of schedules for the alert this will show day of the week and time e.g. working day or other. My next table shows Thresholds for example for an alert the threshold might be 2 e.g. the original select statement cant return any more records than 2 otherwise the alert is triggered. I also have an alert level table, this means that if an alert has only been triggered once in a specific piece of time and alert goes out as an email if it gets triggered again then a text messages is sent out. There is a final table that contains things like email addresses and mobiles associated with each of the alerts. I have the design more or less put together in my head but just trying to think of the best way to put it all together or if anyone has done something similar...Hope that gives a little more detail :)
Thanks...P

exporting only rows from sql in phpmyadmin, only where a certain column has Boolean of 0

"meta/background about the use of code and person using it"
1.site built by professional that left company,
2.I am inexperienced but trying/ want to learn,
3.Customer support site for service reps,
................................................
What im trying to do exactly per stackoverflows parameters.
We have a drop down box listing issues that the customer had in a column labeled "issue_type". I can export via csv entire table load onto excel then give to boss for overall review of what the issues were. However data base has a "hide" column. Its function is that when the row is updated the record is kept but the same "job or call" has only one viewable report on site (the most recently updated one). Hide is a boolean. In conclusion I want to export rows that only has the "hide" column Boolean status at 0, AND to only export the columns "customer", and "issue_type". I can seem to only do one or the other. and have researched a minimum of 4 hours to find answer myself and cannot find a syntax to do both at the same time with phpmyadmin.
I dont want an enormous data that is mostly useless but for issue type and customer but i will have to manually delete all the rows with hide = 1?
Thanks anyone 1st attempt question sorry if not correct for stackflow.
SELECT Customer,Issue_type FROM tickets where hide =0;
Elaborating on what is above for anyone that may be looking for a similar answer, SQL supports the "where" clause of which you can when properly syntaxed select many of your columns and their associated strings, booleans, and numbers to = what your looking for. Wildcards I found later for other uses work as well.
Sorry about the self answer but hopefully someone finds this usefull

Update log table with data from the log table

Due to recent updates to the recent database, I have run into a weird problem. I have two tables, tVehicleDeal table and tVehicleLog table. We did a 'migration' meaning we created an app that will transfer the data from a old database to a more relational database. This process took awhile, but it finished and everything seemed good to go. What happens now, is that anytime tVehicleDeal is updated, the corresponding information is inserted into tVehicleLog. The problem that has occurred is.. I ran a script that would update the current deal in tVehicleDeal to the most recent log in tVehicleLog. I made an error in my script, and not all the current deals in tVehicleDeal were updated properly. As a result, when the users updated the active deal in tVehicleDeal, not all the information was inserted into the tVehicleLog. I need to find a way to update the newest entry with some fields from the past entries such as the date it was titled. Some Deals have as many as 20 different logs for it whereas some may have only 2 or 3. I have found this link here but I'm not 100 percent positive this is what I'm looking for. I have tried something similar to this but I am unable to get anything to work using the examples found on that page. Any other ideas will help greatly!
EDIT:
What I am unable to figure out is how to update a column in tVehicleLog. For example:
In the tVehicleLog table there are 6 results for a particular DealID.
The first through 4 do not have a titled date in it, but the 5th row does have a titled date.
I can't figure out how to update the titled column the 6th row for that dealID based on the 5th row that does have the titled date.
The link provided above looked like it was something I was looking for but I was unable to get that solution to work.
Based on this line from your question,
I can't figure out how to update the titled column the 6th row for
that dealID based on the 5th row that does have the titled date.
It seems like this should fix your problem. It is written only to solve this specific scenario. If other scenarios exist that are not exactly like this one, adjustments may have to be made. If I didn't understand your problem, please post further clarification.
UPDATE L1
SET TitleDate=L2.TitleDate
FROM tVehicleLog L1
INNER JOIN tVehicleLog L2
ON L1.DealID=L2.DealID
AND L2.TitleDate IS NOT NULL
WHERE L1.<PrimaryKeyColumn>=#ThePrimaryKeyColumnOfTheRowYouWantToUpdate

pulling current date queue

I have a view that lists employee (EmpID), request number (ReqNo), date request was opened (OpenDate) and the date it was moved to the next step in the process (AssignDate). What I am trying to do is get an average of the daily queue size. If EmpID 001 has 20 requests on 1/1/13, then has 24 on 1/2/13, 21 on 1/3/13 the average over 3 days should be 21.66, rounded up to 22. I have the following view:
CREATE VIEW EmpReqs
AS
SELECT [EmpID], [OpenDate], [AssignDate], [ReqID]
FROM [Metrics].[dbo].[Assignments]
WHERE OpenDate BETWEEN '01/01/2013' AND '12/31/2013' AND
[EmpID] IS NOT NULL AND
[ReqNo] NOT LIKE 'M%'
I then wrote a query to pull individual employee's queues per day:
/* First attempt to generate daily queue #s */
SELECT * FROM BLReqs
WHERE [BusLiaison] LIKE 'PN' AND
[OpenDate] <= '11/15/2013' AND
[AssignDate] > '11/15/2013'
Because no one has attempted to pull this information before, I have no way of verifying how accurate the above is. I tried using current dates, since I can see those in our database to compare but the code doesn't work, nothing is returned when I change the dates to 2014 and run my query.
What is the easiest way to verify that my code is correct, short of manually counting a day's queue?
Can anyone see any issues with the above scripts?
Is there a way to get the above code to work with current dates?
This question is really hard to answer because it is kind of broad and has little information at the same time. I'll try anyway:
Because no one has attempted to pull this information before, I have
no way of verifying how accurate the above is.
Try checking the result of this query for a few sampled dates.
I tried using current dates, since I can see those in our database to
compare but the code doesn't work, nothing is returned when I change
the dates to 2014 and run my query.
So clearly, the query is not working. You should probably find out why. Run the query for a date of which you know that it should return results but doesn't. Remove conditions one by one to see which one is incorrectly removing all rows. This should be enough to identify the bug.
Can anyone see any issues with the above scripts?
No, looks fine. A very simple query. That's why I said that we have too little information. There is some key piece of information missing that allows us to find the bug.
Is there a way to get the above code to work with current dates?
Stop staring at the code and hoping for a revelation. Debug it. Experiment.

Table structure for Messages System

Hi i need to design a messaging system like facebook. I was thinking to build table similar
(source: serviciipeweb.ro)
where i can store olderMessage in another table so i can make quicker query in Message Main table...
but i cant resolve the problem about deleting messaging. If a user delete a message the other one should still read it.
How can i build it?
I googled but i didnt find anything.
P.S: I must use SQL-SERVER
Thanks
Create two fields in your Message table:
DeletedByFrom
DeletedByTo
Filter your results on this:
where DeletedByFrom = False
So you only get the rows that weren't deleted (in this case by the 'From' user)