Bigquery request on multiple tables - google-bigquery

I would like to request on several tables with the following format name :
project.dataset.fr_table_20221001
project.dataset.fr_table_20221002
...
project.dataset.fr_table_20221030
project.dataset.en_table_20221001
project.dataset.en_table_20221002
...
project.dataset.en_table_20221030
etc with multiple langages and other dates.
Do you know what is the good syntax? Thank you in advance

By request did you mean retrieving table names on a specific dataset?
Can you try this query:
SELECT
CONCAT(table_catalog,'.',table_schema,'.',table_name) as Result
FROM
cars.INFORMATION_SCHEMA.TABLES;
you can change cars to your dataset to view the list of tables from yours. Please see sample output:

Related

Grafana Status timeline not working with PostgresSQL and only one Query

I’m creating a dashboard in Grafana with data extracted from Google Servers and stored in a PostgresSQL Database.
In one of the visualization I would like to create a Status Timeline:
I have created a query in PostgresSQL which returns me the following table:
As my understanding goes, that is the data that is need to create a Status Timeline. (Time, count of a variable and name of the variable count).
But when I copy that query inside Grafana, the chart is not the same as I have imagined:
I don’t know what else to do or how to fix it.
Does anyone has faced this issue before or know how to solve it, in order to get a Status Timeline like the one showed above?
Thank you very much!
As you can see in your last image, the metric names used in the panel are the column names. The status values used are the column values. So you need a table result like that:
executed_on
dev
asia-dev
...
2022-06-07 12:00:00
1
4
...
...
...
...
...

How to count a phrase in Big Query view

I have fir-ui-af***:firestore_export dataset in my BigQuery project.
In this dataset, I have speech_raw_changelog table and speech_raw_latest view.
This is schema of speech_raw_latest view.
In data field which I marked with a red pen, there is JSON data.
This is an example of field and value in data.
I would like to count the number of ******ka#gmail.com in email field in this speech_raw_latest view.
I searched the Internet and found that I should use COUNT function, but I don't know how to use it to solve my problem.
Could you give me any advice, please?
Below is for BigQuery Standard SQL
SELECT COUNTIF(JSON_EXTRACT_SCALAR(data, '$.email') = 'ka#gmail')
FROM `project.dataset.speech_raw_latest`

Suggestion for Matrix Table representaton in SQL Server Tables

Would like to get some suggestions on how to represent the following Matrix in an SQL Table like representation. Thinking of a three table structure like the following
Catid,CatName
LevelId,LevelName
Catid,MinValue,Maxvalue,LevelId
Any Suggestions? The idea is to get information about the level of approval required based on the Amount.

is there a way to join datatables?

I have two datatables that comes from different database servers, the first looks like this:
structure from first dataTable
it shows how many clients each salesperson visited in the specified date.
The second dataTable looks like this:
structure of second dataTable
it shows how many customer the saleperson was supposed to visit.
As i said this data comes from two different servers, i need to do something like a join in database with the key fields (SLPRSNID AND DAYOFWEEK) in order to show in a report the compliance percentage of each salesperson.
My report application is made in VB.NET for desktop environment.
Thanks in advance
btw sorry for my bad english
You can use linq to datasets to accomplish what you are looking for, if that is to get the two datatables into one flattened result set. See this for a description and example: Cross Table Query of Datatables
If you want to maintain a relationship for some reason, consider designing a dataset with the two datatables and a data relation to join them. That will create functions to GetChildRows from the parent, and GetParentRow from the children.
Update #1 - Try this to convert your query result into a datatable. Creating a DataTable From a Query
Dim boundTable As DataTable = query.CopyToDataTable()
Found out Merge(DataTable) Method from MSDN. Hope it will solve your problem
Merge()
Also #SSS suggested answer can be accepted for your problem

Fetching data from multiple tables in yii

I have 2 tables
AutoScriptArgumentClass
id
ScriptArgumentClass
AutoTestScriptMeta
id
AutoTestScript_id
ScriptArgumentClass_id
here is my query.
select sac.id,sac.ScriptArgumentClassType
from AutoScriptArgumentClass sac,AutoTestScriptMeta tsm
where tsm.ScriptArgumentClass_id = sac.id
and tsm.AutoTestScript_id=129
how do I write this in yii
I would like to have in this manner:
**$data=AutoTestScript::model()->findAll('Category_id=:parent_id',
array(':parent_id'=>(int) $_POST['TestCaseCategory']));**
$data=CHtml::listData($data,'id','ScriptName');
foreach($data as $value=>$name)
{
echo CHtml::tag('option',
array('value'=>$value),CHtml::encode($name),true);
}
Thanks
I am afraid this will not be possible, as you are trying to get the data from multiple table into an instance of a CActiveRecordModel of a particular table.
This model does not have the instances of the columns of the other table, hence it cannot not avail them to you.
Thanks.
Its possible in two condition. first you write a function in in your controller which contain the proper query and call the function from cgrid view or you can check the page more efficient way
http://www.yiiframework.com/wiki/281/searching-and-sorting-by-related-model-in-cgridview/
make sure the tables maintain the reletaionship. if your tables are in MYISAM format change it into INODB and try.. hope its works for you