Confluent SchemaRegistry unable to update existing schema - confluent-schema-registry

Trying to Update existing schema in SchemaRegistry, but having error: Schema being registered is incompatible with an earlier schema for subject "kafka-2906-value"
Existing JSON schema: {"subject":"kafka-2906-value","version":1,"id":12,"schemaType":"JSON","schema":"{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","properties":{"InvoiceId":{"type":"integer"},"InvoiceNo":{"type":"string"},"Amount":{"type":"number"},"IsPaid":{"type":"boolean"}}}
Updated curl command with JSON schema: curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \ --data '{"schemaType":"JSON","schema":"{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","properties":{"InvoiceId":{"type":"integer"},"InvoiceNo":{"type":"string"}}}"}'
http://schema-registry-1234567.xx-xxx-1.eee.amazonaws.com:8082/subjects/kafka-2906-value/versions

In the previous version IsPaid is a mandatory field. In the subsequent one it is not.
Schema versions have to be compatible with each other. This can be further looked at
https://docs.confluent.io/platform/current/schema-registry/develop/using.html#sr-top-level-config.
Based on the requirements you can customize the compatibility of the schemas. More details on the compatibility is documented here
https://docs.confluent.io/platform/current/schema-registry/avro.html

Related

Sorting artifacts using aql and cleanup old artifacts

I'm trying to sort the list of artifacts from jfrog artifactory but getting (The requested URL returned error: 400 Bad Request), in the jfrog documentation (https://www.jfrog.com/confluence/display/JFROG/Artifactory+Comparison+Matrix) says it won't work for open source services. After we get list of artifacts need to delete old artifacts from subfolder in the artifactory repo. Tried with CLI and AQL but nothing worked.
Our repo url looks like this
http://domainname/artifactory/repo/folder/subfolder/test1.zip
Like test 1.zip we have many artifacts(let's say 50)in that subfolder. Looking for help on this, anyone pls me on this issue. Thanks.
While sorting is not supported in OSS versions, if you would like to delete artifacts older than a certain time period, you can use Relative Time Operators, parse the output, and use a script to delete those artifacts.
You can also specify a specific date. There are several Comparison Operators that you can use.
You can use the below AQL for reference:
curl -uadmin:password -XPOST "http://localhost:8082/artifactory/api/search/aql" -d 'items.find({"repo": "repo"}, {"path": "folder/subfolder"}, {"created" : {"$before" : "2minutes"}})' -H "Content-Type: text/plain"

AWS Code Build with Github - get changed files

Tangentially related to: AWS CodeBuild with GitHub - only for specific directory
I have a codebuild project and a github repo with many files in it. A user may update any of these files in the git repo. I want to pass the name of the altered file(s) into my buildspec.yaml somehow; IE my merge job logic, specified in the buildspec.yaml, needs to know what files changed to do a per-file operation.
I am not talking about filters; Ie "only trigger this if X,Y,Z changed". Becuase the filter is there for a large number of XYZ, but I need to know which file(s) changed in my buildspec. IE something like $CHANGED_FILE_LIST.
I don't see this here: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
Maybe we have to do something like this: how to find out list of all changed files in git for full jenkins build and not for a particular commit?
git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT
but one would think this meta info could be provided by codebuild
I don't know if there's a blessed CodeBuild way to do this, but assuming you have access to a GitHub token in the build, you can query the GitHub metadata endpoint to get the info you need. Something like
curl -H "Authorization: token ${yourtoken}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/OWNER/REPO/commits/${CODEBUILD_SOURCE_VERSION} | jq '.files[].filename'
will return a list of files in the commit.
See https://docs.github.com/en/rest/commits/commits#get-a-commit for more details.
git diff --name-status $CODEBUILD_WEBHOOK_BASE_REF should do the trick
You can use git diff --name-only $$CODEBUILD_RESOLVED_SOURCE_VERSION $$CODEBUILD_WEBHOOK_PREV_COMMIT
Where $CODEBUILD_WEBHOOK_PREV_COMMIT is the commit id of the previous commit. And $CODEBUILD_RESOLVED_SOURCE_VERSION is the commit id of the actual one.
Inside a build phase you can check the change with:
-
|
if [ "$(git diff --name-only $CODEBUILD_WEBHOOK_PREV_COMMIT $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -e <filde_path>)" != "" ]; then
#your code;
fi

import server file using relative path via REST API

I'm trying to kick-off an import of RDF files into a GraphDB repository via the workbench REST API.
It works fine when the file is in the {graphdb.workbench.importDirectory} directory and the request specifies "filenames": [ "file1.owl" ].
However, if the file is in a subdirectory (eg. {graphdb.workbench.importDirectory}/top/) and the request uses "filenames": [ "top/file1.owl" ], no such luck - nor does "/top/file1.owl" work. The Workbench Import UI shows the entire collection of eligible files under the {graphdb.workbench.importDirectory} directory. The file in question imports when the Workbench UI is used to initiate the import.
My question is: does the REST API support importing server files that are located is such child directories? And if so, what simple syntax am I missing out? any chance I have to specify any other property (eg. "baseURI":"file:/home/steve/graphdb-import/top/file1.owl")
Many thanks for any feedback.
If you have started GDB with -Dgraphdb.workbench.importDirectory=<path_to_the_import_directory> in "Server files" tab you should be able to see listed all files in this directory and in the child directories, which are located in the <path_to_the_import_directory> in following manner:
I've started GDB with
-Dgraphdb.workbench.importDirectory=/home/sava/Videos/data_for_import and in this directory I have subDirectory "movieDB" with two files "movieDB.brf" and "movieDB.brf.gz" and both are shown in the tab like "movieDB/movieDB.brf" and "movieDB/movieDB.brf.gz".
If you want to import these files using cURL use server import URL with method POST or:
curl -H POST 'http://localhost:7200/rest/data/import/server/w1' -H 'Accept: application/json, text/plain, /' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"importSettings":{"name":"movieDB/movieDB.brf","status":"NONE","message":"","context":"","replaceGraphs":[],"baseURI":null,"forceSerial":false,"type":"file","format":null,"data":null,"timestamp":1608016179633,"parserSettings":{"preserveBNodeIds":false,"failOnUnknownDataTypes":false,"verifyDataTypeValues":false,"normalizeDataTypeValues":false,"failOnUnknownLanguageTags":false,"verifyLanguageTags":true,"normalizeLanguageTags":false,"stopOnError":true},"requestIdHeadersToForward":null},"fileNames":["movieDB/movieDB.brf"]}'

Completely delete release with GitHub API

I'm trying to use the github web API to delete and existing release if present like:
curl -u user:pw --request DELETE "https://api.github.com/repos/user/repo/releases/RELEASE_ID"
this deletes the release message, but leaves a tag with the assets which seems to require manual removal. Is there some way to completely delete a release with the github API?
It seems the key if to both delete the release id and tag, that is
curl -u user:pw --request DELETE "$URL/releases/$RELEASE_ID_TO_DELETE"
curl -u user:pw --request DELETE "$URL/git/refs/tags/$TAG_TO_DELETE"
You would need to couple that with:
First: listing the assets
deleting each asset
And also: delete the ref represented by the tag associated to this release.
With GitHub CLI gh 2.18.0, you can do a
gh release delete <tag> [--cleanup-tag]
That will cleanup the associated tag.

Getting ElasticSearch Oracle SQL River Working

I am new to ElasticSearch and am trying to set up an instance on my local machine that will connect to an Oracle SQL database on another server. Currently, I'm using ES 1.5.2 and have the plugin ojdbc6.jar downloaded. I'm also using a Windows machine.
I can open the elasticsearch.bat file and successfully start a Test_Node, but I'm having trouble getting the moving pieces to align. I have pieced together from several question/answers as well as some of the ES documentation the following commands.
My command to build the river:
curl -XPUT "localhost:9200/_river/JDBC_River/_meta" -d #config.json
My #config.json doc:
{"type": "jdbc",
"jdbc": "{
\"strategy\": \"oneshot\",
\"url\": \"jdbc:oracle:thin:#server.database:1521/Hello.WORLD\",
\"user\":\"user\",
\"password\":\"password\",
\"sql\":\"select id as \"_id\", count(*) from table group by stuff\",
\"gridfs\": false
}",
"index": "{
\"index\": \"CHANNEL_DATA\",
\"type\": \"MDM_data\"
}"
}
The command I'm using to check that the river exists:
curl -XGET "localhost:9200/JDBC_River/_search?pretty"
This command receives this output:
{
"error" : "IndexMissingException[[JDBC_River] mising]",
"status" : 404
}
Moreover, the commands I have pieced together for pulling the data back to view and to delete the river are as follows, respectively:
curl -XGET "localhost:9200/JDBC_River"
curl -XDELETE "localhost:9200/_river/JDBC_River/"
Can anyone help me out as to why my river doesn't exist, but it is created? My hunch is that it is a driver issue and that my river isn't actually hitting the oracle database, but I have no idea what syntax should be used as most of the documentation I've found for Oracle JDBC is outdated.