I am currently defining a parameter within my azure pipeline as follows:
parameters:
- name: nodeSize
displayName: nodeSize
type: string
default: size1
values:
- size1
- size2
The result of this, is that when attempting to run the pipeline the user is presented with a drop down menu that allows them to choose one of the defined values, as shown bellow:
My goal is to create my parameters in a way that the user can select from the dropdown box, OR enter their own value. So the resulting dropdown menu would like like:
Size 1
Size 2
<Users optional input>
I'm afraid that this is not possible. You can create two parameters:
parameters:
- name: nodeSize
displayName: nodeSize
type: string
default: size1
values:
- size1
- size2
parameters:
- name: customSize
displayName: customNodeSize
type: string
default: ' '
and then check if customSize size was provided. I understood that this is far away from perfect. But we are limited to functionality we have now.
Related
As in title i ask for optional or dynamic value presence check in script, my goal is only to combine 2 metrics of same type, so joining them would be also a solution.
I have 2 different routs for same metrics, getting answere only from one of them at a time. I'd like to group them into one dashboard like:
fetch container |
{ metric custom.googleapis.com/http/.../count;
metric custom.googleapis.com/http/joe/.../count }
| join
I tried different combinations, outer_join 0 seemed closest, but having no traffic in one of routs causes:
> Input table 1 does not have time series identifier column
> 'metric.requestType' that is present in table 0.
NOTE: One endpoind is NOT connected at all for a period of time
Configurationin similar for each in metrics.yaml:
---
apiVersion: monitoring.cnrm.cloud.google.com/v1beta1
kind: MonitoringMetricDescriptor
metadata:
labels:
app: << app_name >>
name: custom/http/client/custom/requests/count
namespace: << project_name >>
spec:
type: custom.googleapis.com/http/client/custom/requests/count
metricKind: GAUGE
valueType: INT64
labels:
- key: pod_name
You might be able to try outer_join 0,0. I've not tested this, but the suggestion was taken from https://stackoverflow.com/a/70595836 which states that it will substitute zeros if either stream's value is missing. There's a couple of variations on this depending on what you want to do.
I am very new to APIs (a week in) and I’m stuck with a challenge.
I have tables in Postgres and have created models for each. There is a link from one to another (in some circumstances). If the link doesn’t exist then I want to use a default value, held in a different table.
Example:
Table - items
- id (int)
- name (text)
- startDateTime (date)
- endDateTime (date)
Table - itemTypes
- id (int)
- name (text)
- isDefault (boolean)
Table - itemTypesLinkItems
- id (int)
- itemsId (int)
- itemTypesId (int)
- fromDateTime (date)
- toDateTime (date)
At any given date, there will be a list of items that display. Some of those might be linked to itemTypes via the itemTypesLinkItems table, and so I can show the itemTypes.Name. For the remainder, I’d like to show the itemTypes.Name value where the isDefault = true.
I’ve searched all over, tried to do it with SQL views, but no luck. I’m hoping this is something that can be done within the JavaScript of the API.
router.get(‘/:date’, (req, res) =>
db.items.findAll()({
include: [
{
model: db.itemtypelinkitem,
required: false,
include: [
{
model: db.itemtypes
}
]
where: {
startDateTime: {[Op.lte]: req.params.date},
endDateTime: {[Op.gte]: req.params.date}
}
}
]
I just don’t know where to go from here. If I exclude the ‘required’ then only those items with a link are returned. If I include it, then they all show and if there is a link it returns the details, otherwise just returns []. In the event that it returns a [], I’d like to replace that with the values from the default itemTypes.
I hope understood your question well.
You made many to many Relation between (items, itemTypes) and want to get a default
itemType when getting all items.
so I think this problem not related to Sequlize.
You have to insert default 'itemType' while inserting a new record into 'items' table.
So I'm trying to run a query on Google Cloud's datastore as such:
let query = datastore.createQuery(dataType)
.select(["id", "version", "lm", "name"])
.filter("owner", "=", request.params.owner)
.filter("lm", ">=", request.query.date_start)
.groupBy(["lm"])
.order("lm")
Yet I run into an error stating that
no matching index found. recommended index is:
- kind: Entry
properties:
- name: lm
- name: id
- name: name
- name: version
When I run the query with id instead of lm for all the methods I run into no errors.
Is this because in my index.yaml file I have the index as such: ?
- kind: Entry
properties:
- name: id
- name: version
- name: lm
- name: name
Must I actually create a new index with the recommended ordering? Or is there a way I can do this without having to make another index? Thank you!
Yes, you need to create a new index, the existing one you showed is not equivalent, so it can't be used for your query - the property order matters (at least for the inequality filters and sorting). See related Google Datastore Composite index issue
I am writing a mongoose schema, and I would like to understand the properties of the same.
Here is my schema:
var UserSchema = new Schema({
name: String,
username: { type: String, required: true, index: { unique: true }},
password: { type: String, required: true, select: false }
});
Why required is not declared for `name' - ?
Why required declared?
What is select - true/false -means?
When the index - should declared any why?
Why required is not declared for `name' - ?
Answer: When a field is mandatory to fill then in that case we mention it as required. So here "name" is not required or mandatory field.
Why `required' declared?
Answer: As mentioned above, When a field is mandatory to be filled then in that case we mention it as required.
What is select - true/false -means?
Answer: This means that it will not be returned by default in the data when you fetch the document. you can specify if this path should be included or excluded from query results by default.
Schema options
When the index - should declared any why?
Answer: Index should be declared when you are searching data on that field frequently so when you create indexing on that field in that case it do not search that field in all the collections it will search value for that field using index and will return result very quickly.
How indexes work in mongodb
Here, these act as model for your project. So, required is used as validation and index is working as index over that field
Now you have two ways :
either put validation over here in schemas/models
or just manually create validation for form at frontend using JS/Jquery and then long route
Now your answers:
Name is not compulsory to be filled in. That's why no required is put over there.
when there is mandatory to fill any value for that field. Then required is used in schemas.
True/False enables or disables the usage of validation over that field. If you are using false means filling in for that field isn't compulsion at all. But using false is considered a good practice.
Index is special data structure which are used for increasing performance during read/search operations. It increases the speed of operations and are stored in memory.
whenever we have to validate the particular field, so we used required.
required: true means you must fill that field.
required: false means you may or may not fill that field, but its a good practice.
I have for my project, this ES mapping representation :
- BOOK
- label: String,
- active: Boolean
- total_term_occ: Long
- TERMS
- label: String,
- ngram: Byte,
- tot_occurrences: Long,
- books [{
- id: String,
- label: String,
- occurrences: Long,
- tfidf: Double
}]
For each new term (ex: "ES rocks"), I want to :
- Update the total occurrence in the "TERMS" doc
OR
- Create the new term if not exists
AND (if term already exists)
- BOOK :
- Create a new object if the book does not already exist with "occurrences" to 0 and "tfidf" to NULL
OR
- Update the "occurrences" field if the book exists (with a loop ?!)
I want to make a bulk request "update -> script -> upsert" but without getting the document before updating it.
Do you think this is possible with the choice of mapping ? I can't find a good solution....