Specify password on gsql command line

I enabled the authentication and created a user for myself. I am using the gsql client “gsql_client.jar” in a script to run series of gsql queries using my username. The gsql client doesn’t have an option to specify the password, so I have to type my password manually after each and every gsql command in the script. A couple of questions:

  • Do typical TG users use username/password authentication? If not, what kind of authentication do they use?
  • How common do TG users run gsql commands in a script? If it’s common, how do they handle password entry if username/password authentication is used?
1 Like

@jimwu There are a few ways you can use existing tools to execute GSQL scripts against your box.

Python

If you are using Python you could look at the pyTigerGraph package which leverages the gsql_client.jar. You can then have your authentication stored in a file that will pull every time you are executing the GSQL function.

Also in Python, there is a tool called pyTigerGraphBeta in which we removed the java dependency, and the client (driver) is in pure python but has the same functions as the non-beta version.

Documentation:
https://pytigergraph.github.io/pyTigerGraph/GettingStarted/

pyTigerGraph Video:

pyTigerGraph Beta Video:

Sample NoteBook:

Gradle with Giraffle Plugin

Another way is using Giraffle a plugin for Gradle that is built to execute GSQL scripts against your environment. You can have a multitude of environments and run the Gradle Tasks that you generate against your box.

Documentation:

Giraffle Video:

Sample Project using Giraffle:

Step by Step Blog:

1 Like

Thanks Jon!

Looks like there is a hidden switch -p in gsql to pass password, which is similar to mysql. This is all I need for now to run my gsql scripts using gsql client.

I am putting together examples using FPGAs to accelerate graph databases. Should I focus on using Python scripts for my examples since you mentioned pyTigergraph?

1 Like

Most folks know Python so using pyTigerGraph for automating builds wouldn’t be a bad idea. I also love the Gradle tool so I suppose it’s a personal preference. pyTigerGraph is probably the #1 most contributed tool in the ecosystem and is constantly being developed out and used. Giraffle hasn’t had many updates for a while but is still fully functional.

1 Like