Can you grep/search case-insensitive in SchemaCrawler? - schemacrawler

Is there a flag or option that will allow SchemaCrawler to search database objects and ignore case?
The following example will filter out stored procedures that start with "API" even though they are desired output:
--routines=.*api_Insert.*

Jared,
That is a good idea - I will add a --ignore-case option to the SchemaCrawler grep command. Meanwhile, you can try out a regular expression like
--routines=.*[Aa][Pp][Ii]_Insert.*
or
--routines=.*(api|API)_Insert.*
and see if that works.
Sualeh, SchemaCrawler.

Related

Grafana query parsing error with label_values

There are two CouchDB servers and I am using variable in Grafana to visualize some metrics, issue is query with variable end up with wrong prasing:
couchdb_server_node_info{instance="10\\.10\\.10\\.199:9984"}
I do not why it includes the slash, that leads to empty result. am I using correct query "label_values"?
Here is my variable setting, which the result shows two servers:
and here is how I use it:
it is fixed! I had to disable Include All Option

p4 Ztags formatting for queries with multiple response entries

Ztags filters work greatly but I don't know how to use them with ie. p4 filelog where I get many results and each entry has enumerated field like:
... rev0
... change0
... action0
... type0
... time0
... user0
... client0
... desc0
and then field name is incremented, so in the end I don't have consistent field name for formatting when I would like to see only change and description.
Is it possible to target a field like that across all counts?
If you just want change numbers and descriptions, try p4 changes -L FILE as an alternative to p4 filelog FILE. That gives you one message/dict per change, which is much more amenable to simple (stateless) scripting with the -F formatting option.
filelog output is complex enough (it contains nested arrays of individual revisions as well as their per-revision integration history, it follows renames, etc) that you'll need to write some actual code to do anything very useful with it.
I have recently started working on my own CLI wrapper for p4 in Nim language.
In the process, I needed to grok the weird ztag output that p4 gives. I wondered why it did not give an option to output JSON. So I started working on a ztag to JSON converter to use for my p4 CLI wrapper.
The ztag to JSON converter is open sourced at: https://github.com/kaushalmodi/p4ztag_to_json/.
I release its 64-bit Linux static binary builds here: https://github.com/kaushalmodi/p4ztag_to_json/releases
A test filelog ztag output in my test suite
JSON file parsed from that ztag
The ztag format is terrible and inconsistent (see my ztag test suite to realize why I say that), and I hope that Perforce moves to a saner serialization format like JSON to replace it.
In 2020 version perforce introduced new argument -Mj which may help
From documentation:
-Mj
Formats output as line-delimited JSON objects, with non-UTF8 characters replaced with U+FFFD
Note Use the -Mj option with the -z tag option. Otherwise the
marshaled output might be invalid.

exclude a certain path from all user searches

Unfortunately we have a special folder named "_archive" in our repository everywhere.
This folder has its purpose. But: When searching for content/documents we want to exclude it and every content beneath "_archive".
So, what i want is to exclude the path and its member from all user searches. Syntax is easy with fts:
your_query AND -PATH:"//cm:_archive//*"
to test:
https://www.docdroid.net/RmKj9gB/search-test.pdf.html
take the pdf, put it into your repo twice:
/some_random_path/search-test.pdf
/some_random_path/_archive/search-test.pdf
In node-browser everything works as expected:
TEXT:"HODOR" AND -PATH:"//cm:_archive//*"
= 1 result
TEXT:"HODOR"
= 2 results
So, my idea was to edit search.get.config.xml and add the exclusion to the list of properties:
<search>
<default-operator>AND</default-operator>
<default-query-template>%(cm:name cm:title cm:description ia:whatEvent
ia:descriptionEvent lnk:title lnk:description TEXT TAG) AND -PATH:"//cm:_archive//*"
</default-query-template>
</search>
But it does not work as intended! As soon as i am using 'text:' or 'name:' in the search field, the exclusion seems to be ignored.
What other option do i have? Basically just want to add the exclusion to the base query after the default query template is used.
Version is Alfresco Community 5.0.d
thanks!
I guess you're mistaken what query templates are meant for. Take a look at the Wiki.
So what you're basically doing is programmatically saying I've got a keyword and I want to match the keywords to the following metadata fields.
Default it will match cm:name cm:title cm:description etc. This can be changed to a custom field or in other cases to ALL.
So putting an extra AND or here of whatever won't work, cause this isn't the actual query which will be built. I can go on more about the query templates, but that won't do you any good.
In your case you'll need to modify the search.get webscript of Alfresco and the method called function getSearchResults(params) in search.lib.js (which get's imported).
Somewhere in at the end of the method it will do the following:
ftsQuery = '(' + ftsQuery + ') AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"st:site"' + ' AND -ASPECT:"st:siteContainer" AND -ASPECT:"sys:hidden" AND -cm:creator:system AND -QNAME:comment\\-*';
Just add your path to query to it and that will do.

Delete multiple tables in Accumulo?

My development instance of Accumulo became quite messy with a lot of tables created for testing.
I would like to bulk delete a large number of tables.
Is there a way to do it other than deleting the entire instance?
BTW - If it's of any relevance, this instance is just a single machine "cluster".
In the Accumulo shell, you can specify a regular expression for table names to delete by using the -p option of the deletetable command.
I would have commented on original answer, but I lack the reputation (first contribution right here).
It would have been helpful to provide a legal regex example.
The Accumulo shell can only escape certain characters. In particular it will not escape brackets []. If you want to remove every table starting with the string "mytable", the otherwise legal regex commands have the following warning/error.
user#instance> deletetable -p mytable[.]*
2016-02-18 10:21:04,704 [shell.Shell] WARN : No tables found that match your criteria
user#instance> deletetable -p mytable[\w]*
2016-02-18 10:21:49,041 [shell.Shell] ERROR: org.apache.accumulo.core.util.BadArgumentException: can only escape single quotes, double quotes, the space character, the backslash, and hex input near index 19
deletetable -p mytable[\w]*
A working shell command would be:
user#instance> deletetable -p mytable.*
There is not currently (as of version 1.7.0) a way to bulk delete many tables in a single call.
Table deletion is actually done in an asynchronous way. The client submits a request to delete the table, and that table will be deleted at some point in the near future. The problem is that after the call to delete the table is performed, the client then waits until the table is deleted. This blocking is entirely artificial and unnecessary, but unfortunately that's how it currently works.
Because each individual table deletion appears to block, a simple loop over the table names to delete them serially is not going to finish quickly. Instead, you should use a thread pool, and issue delete table requests in parallel.
A bulk delete table command would be very useful, though. As an open source project, a feature request on their issue tracker would be most welcome, and any contributions to implement it, even more so.

LDAP custom attribute cannot be searched?

I have some special custom attributes with my ldap setup. I have a custom attribute called "GroupCode". I have bunch of entries with this special attribute that I was able to write to the ldap database. Lets say that I have an entry with attribute "xyz" and another attribute with "wasd". I search with the filter "(GroupCode=xyz)" and "(GroupCode=wasd)" neither one of these search return anything. However, if I change the filter to "(GroupCode=*)", then it would return all the entries that have the GroupCode attribute. I have examined the attribute properties, and it looks normal, the apache directory studio shows it to be of "String" value, do I don't know why it isn't searching with the filter I provided. My knowledge with ldap structure is fairly limited as it is fairly complexed. Anyone have any idea, please let me know. Much appreciated. Thanks.
can you see if you can formulate the same search criteria into an ldapsearch command in the command line?
ldapsearch -H ldap://LDAP_SERVER -D LDAP_AUTH_LOGIN -b LDAP_BASE -w PW -x "CRITERIA"
if so, then you can then also experiment with your criteria.
ldapsearch -H ldap://LDAP_SERVER -D LDAP_AUTH_LOGIN -b LDAP_BASE -w PW -x "(GroupCode=xyz)"
One possible reason for your issue is that you forgot to specify the EQUALITY and SUSBSTR properties of your custom attribute.
Here is an example for a custom attribute called sAMAccountName:
attributeTypes: ( 1.2.840.113556.1.4.221
NAME 'sAMAccountName'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX '1.3.6.1.4.1.1466.115.121.1.15'
SINGLE-VALUE )

Resources