Import full database from SQL Sever


#1

This command

java -cp
/path/to/mapd/bin/mapd-1.0-SNAPSHOT-jar-with-dependencies.jar:/path/to/sqljdbc4.jar
com.mapd.utility.SQLImporter -d com.microsoft.sqlserver.jdbc.SQLServerDriver -t
mapd_target_table -su source_user -sp source_pwd -c
"jdbc:sqlserver://server:port;DatabaseName=some_database" -ss “select top 10 *
from dbo.some_table”

which in docs is used to import some table result to MapD which is in SQLServer but i want to import full db with all tables to MapD is there any command for it.


#2

Hi,

No, sorry there is no command to import all of you SQLServer db into mapd you will need to do it table by table.

It would be fairly straight forward to write a program/script to invoke SQLImporter over all tables in a db though.

regards


#3

Here’s an example of the way I’d do the same from SQL Server using TSQL:

use MySQLServerDatabaseName
go

select ‘java -cp /path/to/mapd/bin/mapd-1.0-SNAPSHOT-jar-with-dependencies.jar:/path/to/sqljdbc4.jar
com.mapd.utility.SQLImporter -d com.microsoft.sqlserver.jdbc.SQLServerDriver -t
mapd_target_table -su source_user -sp source_pwd -c
“jdbc:sqlserver://server:port;DatabaseName=MySQLServerDatabaseName” -ss “select top 10 *
from ’ + name + '”’
from sysobjects
where xtype = ‘U’

This query outputs the script you need to pull each table in a database across to MapD. Top tip is to get the query working with a single, small table first, then copy and paste the first part of it into this query.

Run the above, copy and paste the output into a text file, and run it as a batch (.bat file). Simple and saves a lot of tedious time keying table names. Can also be run against views. Remember to change / remove the “top 10” clause once you’re satisfied it’s working.

Jon Reade.