mapdqlΒΆ

mapdql [<database>]
       [{--user|-u} <user>]
       [{--passwd|-p} <password>]
       [--port <port number>]
       [{-s|--server} <server host>]
       [--http]

mapdql is the client-side SQL console. You can submit SQL statements to the MapD Core Server and the results are returned and displayed. The options are:

  • [<database>]: Database to connect to. The default is mapd.
  • [{--user|-u} <user>]: User name. The default is mapd.
  • [{--passwd|-p} <password>]: User password. The default is HyperInteractive.
  • [--port <port number>]: Port number of MapD Core Server. The default is 9091.
  • [{--server|-s} <server host>]: MapD Core Server hostname in DNS name or IP address. The default is localhost.
  • [--http]: Use the Thrift HTTP transport instead of the default TCP transport. Must set --port to mapd_web_server‘s port (default 9092).

Once you start mapdql, you can enter ad hoc SQL queries from the command line.

mapdql> SELECT * FROM movies WHERE movieId=260;
movieId|title|genres
260|Star Wars: Episode IV - A New Hope (1977)|Action|Adventure|Sci-Fi

In addition to SQL statements mapdql also accepts the following backslash commands:

  • \h: List all available backslash commands.
  • \u: List all users.
  • \l: List all databases.
  • \t: List all tables.
  • \v: List all views.
  • \d <table>: Describe all columns of a table.
  • \d <view>: Describe the results of a view SELECT statement.
  • \c <database> <user> <password>: Connect to a new database.
  • \gpu: Switch to GPU mode in the current session.
  • \cpu: Switch to CPU mode in the current session.
  • \timing: Print timing information.
  • \notiming: Do not print timing information.
  • \version: Print MapD Core Server version.
  • \memory_summary: Print memory usage summary.
  • \copy <file path> <table>: Copy data from file on client side to table. The file is assumed to be in CSV format unless the file name ends with .tsv.
  • \copygeo <file path> <table>: Experimental support for copying a server side shapefile to a new table.
  • \q: Quit.

For example, you can describe a table using the \d command. Note that, unlike SQL statements, backslash commands do not require a semicolon at the end of the line.

mapdql> \d movies
CREATE TABLE movies (
movieId INTEGER,
title TEXT ENCODING DICT(32),
genres TEXT ENCODING DICT(32))

mapdql automatically attempts to reconnect to mapd_server in case it restarts due to crashes or human intervention. There is no need to restart or reconnect.

Note

mapd_web_server imposes a default one hour timeout on all individual HTTP requests, including those made from mapdql when using the Thrift HTTP transport. If your queries are expected to take longer than this amount of time, please use either mapdql‘s TCP transport (the default) or increase this timeout timeout using mapd_web_server‘s --timeout option.