changning the num-mappers for mutiple tables in single sqoop command - import

I have some tables in MySQL and I need to import all the tables to HDFS at a time using the single command for this I will use import-all-tables. But for 2 tables I need to get 3 mappers and for 2 tables I need to get 4 mappers. I need to achieve this in single sqoop command.

Related

Inserting value with multiple lines are different in pyspark and simple sql query via jdbc (hive)

If you run this sql query (using jdbc, hive server):
--create table test.testing (a string) stored as ORC;
insert into test.testing values ("line1\nline2");
I want to get 1 record but I'll get 2 reconds in tables.
If you run this sql query but using pyspark:
spark.sql("""insert into test.testing values ('pysparkline1\npysparkline2')""")
I'll get 1 record in table
How I can add multiple row data in table column using "insert ... values (...)" statement to manage this problem via jdbc?
P.S. Query type "INSERT... from SELECT" is not suitable and i can not change line delimeter in create query

Joining tables from separate postgres tables with Ecto.Query

I have a postgres database with two schemas that I often need to join between. I’ve been using the Repo.all(%{query | prefix: "customers"}) when it’s just one table, but I'm not sure the proper way to add a prefix when I'm joining "customers.contacts" with "accounts.details" in one query.

DB2 replication of records across differing schemas

We have 2 db2 instances, each with a DB having tables with differing sets of columns. For e.g. Table T1 has 5 columns in one DB while having 3 columns in the other DB.
We would like to replicate data from T1 from one DB to another. Whil replicating, we would additionally want to apply certain transformation so that the 5 columns in the source table can be mapped to 3 columns in the target.
SQL Server lets you modify the stored procs that insert the record in the target DB. Its called MCALL or XCALL mechanism.
Does DB2 have such a feature by which a source table having one schema can be replicated to a target table with a different schema?
Thanks,
Yash
There are various replication mechanisms that you can use with DB2, all of them allow you to manipulate replicated data. You didn't mention what type of replication you are planning to use; here's an example for SQL Replication: http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.swg.im.iis.db.repl.sqlrepl.doc/topics/iiyrssubmanipoverview.html

How can i retrieve data from two tables in Cassandra Database

I have to retrive the data from two tables,
Here are my two tables in Cassandra DataBase.
employee is keyspace,
Two tables:
emp:- "eno" is primay key,"username","password"
Dept:-"dno" is primary key ,"eno","dname"
Now i want to retrieve the data from two tables, e.g. eno,username,password,dno,dname.
How can i retrieve data from two tables?
How can i retrieve data from two tables?
You can't do it in one query if that is what you are asking. That means that you have to carry out two queries and let your application simulate a join, or the other option, denormalize your data so it is in one table.
As for actually carrying out the query there are bundles of APIs that can retrieve data from Cassandra.
Assuming your column families are emp and Dept you can do querying using the cli:
$ ./cassandra-cli -host localhost -port 9160
$ [default#unknown] USE employee
# single row (collection of columns)
$ [default#employee] GET emp['eno']['username']['password'] as ascii;
# 10 rows for emp column family (aka table)
$ [default#employee] LIST emp limit 10;
Check the documentation for Cassandra 0.7 for using the CLI.

Using MySQLdump for sub-set of database migration

I've been using both mysql and mysqldump to teach myself how to get data out of one database, but I consider myself a moderate MySQL newbie, just for the record.
What I'd like to do is get a sub-set of one database into a brand new database on a different server, so I need to create both the db/table creation sql as well as populating the data records.
Let's say my original db has 10 tables with 100 rows each. My new database will have 4 of those tables (all original columns), but a further-refined dataset of 40 rows each. Those 40 rows are isolated with some not-so-short SELECT statements, one for each table.
I'd like to produce .sql file(s) that I can call from mysql to load/insert my exported data. How can I generate those sql files? I have HEARD that you can call a select statement from mysqldump, but haven't seen relevant examples with select statements as long as mine.
Right now I can produce sql output that is just the results set with column names, but no insert code, etc.
Assistance is GREATLY appreciated.
You will probably have to use mysqldump to dump your tables one at a time and using the where clause
-w, --where='where-condition'
Dump only selected records. Note that quotes are mandatory:
"--where=user='jimf'" "-wuserid>1" "-wuserid<1"
For example:
mysqldump database1 table1 --where='rowid<10'
See docs: http://linux.die.net/man/1/mysqldump
mysqldump each table with a where clause like Dennis said above. one table at a time and merge the scripts with cat
cat customer.db order.db list.db price.db > my_new_db.db