Python: invalid syntax error while using es2csv - python-2.7

This is the query I am trying to use in order to connect to elasticsearch, which is in (172.21.150.230) in order to pull out information in a csv format:
es2csv -u http://xxx.xx.xxx.xxx:5601/ -f _all -d doc -i test2 -r -q '{"query": {"match": {"NAME": "xxx"}}}' -o database.csv
However, I get SyntaxError: invalid syntax
Thanks

Which version are you using?
This error raised when your json query is not valid or when you forget to add -r argument.

Related

I get pattern error when running cov-analysis --tu-patern

I am trying to run the following in a makefile
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -b '/home/SI/YYYY' -w '../XXX' \
--objdir '' -c '/home/coverity/cov-analysis-linux64-2018.06/bin/cov-analyze --dir XXX ... \
--coding-standard-config /home/coverity/cov-analysis-linux64-2018.06/config/coding-standards/misrac2012/misrac2012-all.config /
--paths 100000 --tu-pattern "file('.*\.c$')";'
I get the following error because of -c ' --tu-pattern "file('.*\.c$')";'
Illegal character in pattern: .
How can i write the pattern so it will consider only c file?
Thanks
but i get the error
"file('''*.c$''')" worked

Django + Postgres: Trying dump and restore database, but are seeing ERROR: relation "*_id_seq" does not exist for all sequence tables

I am trying to move a database from a virtual machine (docker-machine) over to a database server on azure. I am first using the following command to dump the database to a local file:
pg_dump -h <virtual-machine-ip> -U <username> postgres > dump.sql
Then I try to restore it on the new server:
psql -h <database-server-ip> -U <username> -d <new_database_name> -f dump.sql
Which produces a lot of errors (example below):
SET
SET
SET
SET
SET
SET
SET
SET
COMMENT
CREATE EXTENSION
COMMENT
SET
SET
SET
CREATE TABLE
ALTER TABLE
psql:dump.sql:66: ERROR: syntax error at or near "AS"
LINE 2: AS integer
^
psql:dump.sql:69: ERROR: relation "auth_group_id_seq" does not exist
psql:dump.sql:75: ERROR: relation "auth_group_id_seq" does not exist
CREATE TABLE
ALTER TABLE
psql:dump.sql:101: ERROR: syntax error at or near "AS"
LINE 2: AS integer
^
psql:dump.sql:104: ERROR: relation "auth_group_permissions_id_seq" does not exist
psql:dump.sql:110: ERROR: relation "auth_group_permissions_id_seq" does not exist
CREATE TABLE
ALTER TABLE
psql:dump.sql:137: ERROR: syntax error at or near "AS"
LINE 2: AS integer
^
psql:dump.sql:140: ERROR: relation "auth_permission_id_seq" does not exist
psql:dump.sql:146: ERROR: relation "auth_permission_id_seq" does not exist
CREATE TABLE
ALTER TABLE
psql:dump.sql:175: ERROR: syntax error at or near "AS"
LINE 2: AS integer
^
psql:dump.sql:178: ERROR: relation "clients_client_id_seq" does not exist
psql:dump.sql:184: ERROR: relation "clients_client_id_seq" does not exist
CREATE TABLE
ALTER TABLE
psql:dump.sql:214: ERROR: syntax error at or near "AS"
LINE 2: AS integer
I have tried reading the docs on pg_dump, but whatever I do, I get the same result...
Any idea of what is happening here? Have I missed some options that should have been included in the dump command?
Thank you very much!
As Valdemar stated, the AS integer was introduced in 10.x, and is not backwards-compatible. If you are able to regenerate the dump through the command-line interface (pg_dump), here are the steps I would advise :
Dump the database in plain-text format using the -Fp (or --format=plain)
Edit the generated file to get rid of the AS integer statements
Import the altered file in your destination database
TL;DR
pg_dump -h <virtual-machine-ip> -U <username> -Fp postgres > dump.sql
sed 's/AS integer//' dump.sql > altered_dump.sql
psql -h <database-server-ip> -U <username> -d <new_database_name> -f altered_dump.sql

Apollo GraphQL iOS

I add this run script on my swift3 project
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate '/*.graphql' --schema schema.json --output API.swift
When I build I get this error:
find: /Users/userName/Documents/Swift: No such file or directory
find: Apps/appName/appName: No such file or directory
find: /Users/userName/Documents/Swift: No such file or directory
find: Apps/appName/Carthage/Build/iOS: No such file or directory
++ exec apollo-codegen generate '/*.graphql' --schema schema.json --output API.swift
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
with the following versions
- Apollo (0.8.0):
- Apollo/Core (= 0.8.0)
- Apollo/Core (0.8.0)
I had to change
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh
to:
$APOLLO_FRAMEWORK_PATH/Resources/check-and-run-apollo-codegen.sh

mongoexport regex unnknown option

mongoexport --db ucc_prod /host:myserver /port:27017 --username user1 --password password1 /query:'{copysheet: {$regex: "/^.*pdf/"}}' /out:copysheets.csv --type=csv --fields svOrderId,svItemId --collection copies
gives me error
2016-09-02T08:17:34.632-0500 error parsing command line options: unknown option "^.*pdf/}}'"
What syntax am I missing here?
You may use
--query "{ 'copysheet': { '$regex': '^.*pdf', '$options':'' }}"
The point is that you should pass the data to the query argument as JSON.
See reference:
--query <JSON>, -q <JSON>
Provides a JSON document as a query that optionally limits the documents returned in the export. Specify JSON in strict format.
Note: on different systems, you might need to swap single with double quotes.

Sign data with SoftHSM

I want to sign (or encrypt) some data using SoftHSMv2 and pkcs11-tool.
So far, I generated a RSA keypair with :
pkcs11-tool --module=/usr/local/lib/softhsm/libsofthsm2.so -l --pin mypin -k --key-type rsa:1024 --id 01 --label mykey
But when I try to sign something :
echo "some text" > input.txt
pkcs11-tool --module=/usr/local/lib/softhsm/libsofthsm2.so -l --pin mypin -s -i input.txt
I get the following error message :
Using slot 0 with a present token (0x0)
error: Sign mechanism not supported
Aborting.
From what I understood reading the documentation, I should be able to sign with SoftHSM, but maybe I'm wrong ?
Is there an option to add during compilation or something else to fix my problem ? If not, is there other SSM products in the market ?
You seem to have forgotten -m (--mechanism) option. Read more here.