Mapdql - get create table/schema definition from file


#1

Hi,

Is there a way to pipe in or in some way reference external files which have commands in them.

More specifically, I’ve got some standard CREATE TABLE … commands that are quite long, and would be easier to reference them in some way rather than pasting into the console each time.

Any tips/tricks would be appreciated,

:slight_smile:


#2

Hi,

There is a mapdql_history file. I think if you cut-paste your long SQL into the file, your can use it in mapdql.

Sorry I don’t have a MapD with me now, can’t tell you the exact file name, and can’t verify the method. But worth a try.

Cheers,


#3

Interesting idea, and yes, I know the file you are speaking of :slight_smile:


#4

Hi tflinz,

The usual pipe and redirect methods should work fine, just make sure you have a semicolon ; at the end of each statement in the piped-in files.

cat create_foo.sql | ./bin/mapdql -p HyperInteractive

./bin/mapdql -p HyperInteractive < create_foo.sql > out_foo.txt

echo "drop table foo;" | ./bin/mapdql -p HyperInteractive

#5

oh. awesome! :slight_smile:
That is definitely what I was looking for!
Thank you!