I am trying to use the SQL table check operator to check if a table has more than 1 rule.
But it return error “Missing right parenthesis”
N/b: Connecting to oracleDB
test_gtfm_operator = SQLTableCheckOperator(
task_id="test_gtfm",
conn_id='airflow_db',
table=table ,
checks={
"row_count_check": {"check_statement":"COUNT(*) > 0", }
},
)
Related
I'm facing a problem trying to process my cube (1400) on SSMS. The cube consists of 2 existing cubes being combined. Every table that uses the following M-code is returning an error: An M partition uses a data function which results in access to a data source different from those defined in the model
"expression": [
"let",
" Source = Odbc.Query(\"dsn=ODS_STG\", \"select#(tab)*#(lf)from#(tab)work_area_06.datamart_vx_dpm_pc_task#(lf)where#(tab)cast(left(cast(fk_snapshotdate as string),4) as bigint) >= year(current_timestamp())-1;\")",
"in",
" Source"
]
Any help on tackling this error would be much appreciated.
I had to change the string to:
Source = Odbc.Query(\"dsn=ODS_STG\", \"select#(tab)*#(lf)from#(tab)work_area_06.datamart_vx_dpm_pc_task#(lf)where#(tab)cast(left(cast(fk_snapshotdate as string),4) as bigint) >= year(current_timestamp(**))-1\")",**
"in",
" Source"
]
I'm trying to use two UPDATE queries on my database:
UPDATE equipment
SET equip_level = 'Hero'
WHERE equip = ('Amulet of Immortality');
UPDATE equipment
SET equip_level = 'Master'
WHERE equip = ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death');
The first one works just fine but the second one (with multiple entries) gives me the following error:
[11:37:16] Error while executing SQL query on database 'test': row value misused
The tutorial that I'm looking at (https://digitalfellows.commons.gc.cuny.edu/2016/04/08/fun-times-with-sqlite-or-a-beginners-tutorial-to-data-management-and-databases-with-sql/) uses the following format for the second query:
UPDATE equipment
SET equip_level = 'Master'
WHERE equip = IN ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death')
But that gives me a syntax error:
[11:49:48] Error while executing SQL query on database 'test': near "IN": syntax error
How can I correct this?
remove the equals sign:
UPDATE equipment
SET equip_level = 'Master'
WHERE equip IN ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death')
I'm having a bit of trouble with a Firebase query, mainly due to the size of the dataset I am querying.
What I would like to achieve is:
Find all tshirts where brandStartsWith = 'A' and salesRank is between 1 and 100
I've started to pad this out, but I am running into an issue whereby I can't seem to get the data due to having over 300,000 records within t-shirts.
If call it within React when the page loads, after a while I get the following error in console:
Uncaught RangeError: Invalid string length
Here is the code I am using to get me started, but I'm not sure where to go. Looking at the solutions on this question it seems I need to download the data per my query below, and then sort it on the client side. Something I cant seem to do
firebase.database().ref('tshirts')
.orderByChild('brandStartsWith')
.equalTo('A')
.once('value', function (snapshot) {
console.log(snapshot.val())
})
You're going to need to create a combined key as you can only do one where clause at a time.
{
"tShirts" : {
"brandStartsWith" : 'A',
"salesRank" : 5
"brandStartsWith_salesRank" = 'A_00005' //pad for as many sales ranks as you have
}, {
"brandStartsWith" : 'B',
"salesRank" : 108
"brandStartsWith_salesRank" = 'B_00108' //pad for as many sales ranks as you have
}, {
"brandStartsWith" : 'C',
"salesRank" : 52
"brandStartsWith_salesRank" = 'C_00052' //pad for as many sales ranks as you have
}
}
This will allow you to do this query:
firebase.database().ref('tshirts')
.orderByChild('brandStartsWith_salesRank')
.startAt('A_00001')
.endAt('A_00100')
.once('value', function (snapshot) {
console.log(snapshot.val())
})
Don't forget to update your rules to .index brandStartsWith_salesRank
I am new to Development in COGNOS 10.2. I am trying to create a logic:
IF(ParamCount('ord')=1) THEN ('SI')ELSE('NULL')
IF(ParamCount('ord')>1) THEN ('MI')ELSE('NULL')
IF(ParamCount('ord')< ) THEN('NULL')
The first one give no error how ever the last two gives error. Please suggest.
Niha
Use search case. Following is how it should be. Also if you are trying to return null, it should not be in quotes.
CASE
WHEN ParamCount('ord') = 1 THEN 'SI'
WHEN ParamCount('ord') > 1 THEN 'MI'
WHEN ParamCount('ord') < 1 THEN null
ELSE null
END
I try to create a loop that will create data frames by using different sql queries that have the same name exept the day number.For example here is the name for query that is for day 1 :SF_2013_Day1_BaseLine and this is for day 6: SF_2013_Day6_BaseLine. I wrote this code (below) but I got an error : Error: unexpected ',' in "for(i in 3," .So any Idea how can i get this code to work ?
Thank you
for (i in 1,3,6,10,14,21,30) {
SF_FinalviewQ3_2013_Day[i]_BaseLine<-sqlQuery(DB,"select * from [SF_2013_Day[i]_BaseLine]");
dim(SF_Day[i]_BaseLine)}
After a change based on #Pgibas edvice to this code :
for (i in c(1,3,6,10,14,21,30)) {
SF_FinalviewQ3_2013_Day[i]_BaseLine<-sqlQuery(DB,"select * from [SF_2013_Day[i]_BaseLine]");
dim(SF_Day[i]_BaseLine)}
I got this error: Error: unexpected input in "for(i in c(3,6)){glm_d[i]_" . What can I do to resolve the problem?
You need to resolve i within the names first:
for (i in c(1,3,6,10,14,21,30)) {
set <- sqlQuery(DB, paste0("select * from [SF_2013_Day[", i, "]_BaseLine]"))
eval(parse(text = paste0("SF_FinalviewQ3_2013_Day", i, "_BaseLine <- set"))
dim(set)
}