got error while trying to remove query from QueryStore - sql-query-store

I was tring to remove a slowquery from QueryStore, but I got an error message saying:
query can't be deleted as there is an active forcing policy on this queryid while executing "sp_query_store_remove_query #queryid"
Can't we remove the query in this case?
I tried exec sp_query_store_remove_query #queryid.

Try this.
ALTER DATABASE WideWorldImporters SET QUERY_STORE CLEAR;

Related

Jooq database/schema name mapping

I use jooq to generate objects against a local database, but when running "for real" later in production the actual databases will have different names. To remedy this I use the <outputSchemaToDefault>true</outputSchemaToDefault> config option (maven).
At the same time, we have multiple databases (schemas), and are using a connection pool to the server like "jdbc:mysql://localhost:3306/" (without specifying a database here).
How do I tell jooq which database to use when running queries?
I have tried all config I can think of:
new Settings()
.withRenderSchema(true) // true/false seems to make no difference.
.withRenderCatalog(true) // true/false seems to make no difference.
.withRenderMapping(new RenderMapping()
.withDefaultSchema("my_database") // Seems to have no effect.
// The above 3 configs always give me an error saying "no database selected".
// Adding this gives me 'my_database.my_table' does not exist - while it actually does.
.withSchemata(new MappedSchema()
.withInputExpression(Pattern.compile(".*"))
.withOutput("my_database")
));
I have also tried using a database/schema name, as in not configuring outputSchemaToDefault. But then, adding the MappedSchema code above, but that gives me errors with "'my_databasemy_database.my_table' does not exist", which is correct. I have no clue why that code gives me the database/schema name twice?
Edit:
When jooq tells me that the db.table does not exist, if I put a break point in a good place and get the sql from jooq and run exactly that against my database it does work. But jooq fails to run it.
Also, I'm using version 3.15.3 of jooq.
I solved it. Instead of using .withInputExpression(Pattern.compile(".*")), it seems to work with .withInput("").
I'm still not sure why it works, or if this is the "correct" way of solving it. But at least it is a way forward.
No clue why using the pattern, I got the name twice though. But that one I'll leave alone.

Key not being recognized in JSON

I have following JSON that i am trying to parse.
{"id":1,"colour":"blue","count(colour)":1}
It is a result of what i have returned from my sqlite3 select staement. I am doing a count(colours), which is being returned as the key in the JSON.
Then when i attempt to reference the value using .count(colour), my node app fails giving me an error that colour is not defined. Note, that referencing .id works just fine.
Has anybody ran into this issue before or can provide any help?
If your JSON is in some variable, myjson, and you access it directly with myjson.count(colours), you get the error because it's trying to execute a function in your object.
It works as you expect if you access via string like this: myjson["count(colour)"].

Get more details out of a `ConditionalCheckFailedException` in AWS DynamoDB?

In DynamoDB it is possible to set a ConditionExpression on a single attribute like this:
ConditionExpression: 'attribute_exists(user_id)'
If this ConditionExpression is defined on an update, and the user_id does not exist, the ConditionExpression evaluates to false and returns an exception:
message: 'The conditional request failed',
code: 'ConditionalCheckFailedException',
requestId: 'KPFMA7S5P110FCOMLPMKP15UDBVV4KQNSO6AEMVJF66Q9ASUAAJG',
statusCode: 400
Whilst there is only one condition to evaluate everything is clear, but when multiple conditions are specified, DynamoDB does not report which condition failed:
ConditionExpression: 'attribute_exists(user_id) and iq = 85'
then exception is the same as above, thus it's impossible to say what exactly caused the condition evaluated to false.
Is there a way (even hacky one) to get more details out of that exception information?
Unfortunately DynamoDB will not provide any additional details - it will not tell you which part of the ConditionExpression failed.
The only thing I can think of doing is to execute a query immediately before or after you run the update expression, compare the necessary attributes, and log the result.
If you ran the query before the update, you could execute or skip the update as required. In effect you would be implementing your own condition handling.
Alternatively you could execute the query as part of a catch block after your update try block, such that the query would only run if the update failed.

Error while using topcount

I'm using the following MDX query:
SELECT [Measures].[Unita (libri)] ON COLUMNS,
TopCount([Anno].[Anno].Members, 10.0, [Measures].[Unita (libri)]) ON ROWS
FROM [Pubblicazioni]
But i always get back an error:
Error Occurred While getting Resultset
MDX Query Editor
An error occurred while rendering Pivot.jsp. Please see the log for details.
I can't access the log (for some reason the server is not writing logs) but i think it's not normal to get this error with this simple query. Any ideas about?

Invalid token information returned by describe_ring: {}

I am trying to use CassandraStorage in pig, and I am getting the error "Invalid token information returned by describe_ring: {}" whenever I try to output to Cassandra. What could I be doing wrong?
This can happen if your cassandra cluster/keyspace is not set properly. Try to enable debug logs and see exact Exception

Resources