How to run Algolia Firestore extension import script? - google-cloud-firestore

I'm installing the Algolia extension for Firestore. Setup works just fine and it updates indices on add delete and update. But now I want to backfill it with existing data.
The following steps are provided in the setup guide but I have no clue on HOW to run that script. I've tried pasting it directly in node shell and powershell, adding it to a js or ps1 file and running that but I don't know what kind of script this is.
How do I run this script? (I have a service account json next to it)

It's bash...
It works when pasted directly in bash with spaces on each newline after the line terminator. Or as a .sh file from the commandline.
#!/bin/bash
LOCATION=europe-west3\
ALGOLIA_APP_ID=xxx\
ALGOLIA_API_KEY=xxx\
ALGOLIA_INDEX_NAME=organizations\
COLLECTION_PATH=organizations\
FIELDS=name,address,city\
GOOGLE_APPLICATION_CREDENTIALS=./xxx.json\
npx firestore-algolia-search

Related

Load script command on windows not working

Trying to run an orientdb script from the command line using:
console.bat then the script name e.g. console.bat myscript.osql.
When I run the command I get an error
!Unrecognized command: '?select from TestClass' (TestClass isnt the real class but it will do).
If I run the commands manually on the console they work as I would expect.
I am on windows 10 creators edition, orientdb 2.2.30.
Assuming you're connected to your database and your script is in the same directory as console.bat (bin), you should execute LOAD SCRIPT myscript.osql to properly load it.
See LOAD SCRIPT from the docs.

Flyway migrate doens't run in AWS EC2 userdata powershell script

I have placed flyway migrate command in a powershell script as I want it to run automated once i create an EC2 windows box. Powershell runs the "flyway migrate" command, but actually flyway isn’t executing anything. And I’ve proven this by outputting a file when the flyway migrate function was executed. See attached the NoOutput png.
Click here to see screenshot NoOutput
Then If I manually execute the command, it works as expected. What am I doing wrong? What can be the cause of not running from powershell? I don't think it is powershell to be blaimed for. And if it is, what syntax should i use? I am actually thinking of creating an .exe file with the flyway.cmd migrate :)))--bit of over thinking i guess.
Click here to see screenshot WithOutput
Try running flyway as follows:
&$FlywayDir\flyway.cmd | Out-File C:\filename.txt
The ampersand (the 'and' sign) here tells PowerShell to execute that command, instead of treating it as a cmdlet or a string.
From this blog: http://edgylogic.com/blog/powershell-and-external-commands-done-right/

PostgreSQL copy 0?

I have written a simple batch script which loops a directory and echoes some details about each file.When I view its results in the CMD terminal or output it to some file, I can view the results as expected.
The problem comes with PostgreSQL: when I try to import its results into a table, executing the following command:
copy schema.table(field) from program 'C:\\...\\my_bat.bat' with CSV header delimiter E'\t';
It imports 0 results, whereas if I run the same command pointing to a similar batch file in another directory, it works as expected.
What's going on? I am using windows.
Update: I have tried running the copy command calling program again on another batch script and this time, only a part of the string output is being imported.
The service user postgres needs sufficient permissions to run the program.
I remember that it was hard to change settings for that account on windows XP, I have not tried on more recent windows - service users are hidden by most GUI tools.

Mac OS X 10.11 - Add Postgres to $PATH Unsuccessful

I am trying to install Postgres in order to use Heroku.
I am following the instructions in the Heroku tutorial, and after Postgres installation (which was successful), it says to configure my .bash_profile to allow for Postgres command line functionality.
I am following the instructions here, but I am unable to successfully add this line:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
That folder does in fact contain "psql" on my computer, so it should work. Here is my current .bash_profile:
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# The next line updates PATH for the Google Cloud SDK.
source '/Users/user/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/Users/user/google-cloud-sdk/completion.bash.inc'
I tried to add the Postgres line to the end of that file, but it is not working. After searching online, there does not seem to be consensus on how to add PATHs to .bash_profile. I have tried many versions listed, but none have worked.
Please let me know if I'm doing this incorrectly!
Add this line to the end of your .bash_profile:
export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH
This makes the search of a binary to look in that location "BEFORE the rest of the PATH"
Kill all instances of terminal and open it again, then it should work.
Try which xxx where xxx is the name of some binary inside /Applications/Postgres.app/Contents/Versions/latest/bin and check if it's returning that location.
Tell me if it works.

How to run scripts in mongoDB

I have the following scripts, which can be run in Sublime text built-in build.
I want to know how to run the sample script in command line
like mongo -f sample_script.js, thanks
sample_script.js
use security_development;
Object.bsonsize(db.grouped.findOne({"_id":"00063acf1078671c6b90d46effad474b"}))
You don't need the -f. Move database selection to command-line argument, though (use and show helpers don't work when executed from a file)
mongo -d security_development sample_script.js