![]() ![]() perform SQL COPY with data stream to the client host \ef edit function definition with external editor \e edit the query buffer (or file) with external editor \h help on syntax of SQL commands, * for all commands ![]() \g or execute query (and send results to file or |pipe) \copyright show PostgreSQL usage and distribution terms Accessing help from within the psql prompt requires you to type "\?" i.e., a backslash followed by a question ~]$ psql.Syntaxes are terminated for SQL statements with a semicolon " " similar to that in hive. NOTE We can familiarize ourselves with the utilities and syntaxes later on since the sandbox is meant to tryout and break stuff. We can also execute commands from CLI without going into the psql shell and execute commands from the ~]$ psql -h 172.16.105.137 -p 10432 -d mydb -c "select * from mytable limit 5".Here is how we would need to connect if these variables are not set ~]$ psql -h 172.16.105.137 -p 10432 -d mydemo NOTE: Having these variables configured is a matter of convenience, else you would end up typing these variables. We can ensure that we have all these variables ~]$ env | egrep 'PGHOST|PGPORT|PGDATABASE' Some of the key environment variables required to connect are PGPORT (-p), PGHOST(-h), PGDATABASE(-d) & -c.W, -password force password prompt (should happen automatically)įor more information, type "\?" (for internal commands) or "\help" (for SQLĬommands) from within psql, or consult the psql section in the PostgreSQL w, -no-password never prompt for password U, -username=USERNAME database user name (default: "gpadmin") p, -port=PORT database server port (default: "10432") h, -host=HOSTNAME database server host or socket directory (default: "") x, -expanded turn on expanded table output T, -table-attr=TEXT set HTML table tag attributes (e.g., width, border) P, -pset=VAR set printing option VAR to ARG (see \pset command) ![]() F, -field-separator=STRING set field separator (default: "|") A, -no-align unaligned table output mode S, -single-line single-line mode (end of line terminates SQL command) s, -single-step single-step mode (confirm each query) q, -quiet run quietly (no messages, only query output) o, -output=FILENAME send query results to file (or |pipe) n, -no-readline disable enhanced command line editing (readline) L, -log-file=FILENAME send session log to file E, -echo-hidden display queries that internal commands generate e, -echo-queries echo commands sent to server version output version information, then exit 1 ("one"), -single-transaction execute command file as a single transaction X, -no-psqlrc do not read startup file (~/.psqlrc) v, -set=, -variable=NAME=VALUE set psql variable NAME to VALUE l, -list list available databases, then exit f, -file=FILENAME execute commands from file, then exit d, -dbname=DBNAME database name to connect to (default: "gpadmin") c, -command=COMMAND run only single command (SQL or internal) and exit This is psql 8.2.15, the PostgreSQL interactive terminal (Greenplum version). Now that we can locate the "psql" utility, lets list down the ~]$ psql -?.Ensure that you have the binaries set in the environment, usually this should be taken care by itself during the ~]$ env | egrep ~]$ which ~]$.Switch from root user account to "gpadmin" ~]# su - ~]$.For our exercise, we will be using this account. This by default is the superuser for the cluster and has all the privileges. NOTE: HAWQ has a preconfigured user account associated with it, similar to hive, known as "gpadmin". Last login: Mon Jun 20 15:31:20 2016 from ~]#Ĭonnecting via Virtualbox HW13382:ODBC srai$ ssh -p password: For connecting via VMWare Fusion, you need to be aware of the IP address allocated to your virtual box.Ĭonnecting via VMWare Fusion HW13382:ODBC srai$ ssh -p password: A SSH interface to the sandbox either via HOST/remote OSX Or Putty when working with Windowsĭepending upon the setup i.e., VirtualBox or VMWare Fusion for HAWQ & HDP, you can choose the connection method.Requirement for above is to ensure that there is either a sandbox configured with HAWQ.Understanding how to access and list the options available for command line interface.Get familiar with psql command line CLI interface for HAWQ. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |