Esempio n. 1
0
 def test_export_call(self):
     self.assertEquals(
         Sqoop.export_data().to_rdbms(rdbms="mysql", username="******", password_file="/user/cloudera/password",
                                      host="localhost", database="sqoop_tests").call(
             stored_procedure="procedure").from_hdfs(
             export_dir="some").build(),
         '--connect jdbc:mysql://localhost/sqoop_tests --username root --password-file /user/cloudera/password --export-dir some --call procedure')
Esempio n. 2
0
def load_data_from_hdfs_to_rdbms(context):
    # Configure and run Sqoop export job
    _sqoop_export_job_ = Sqoop.export_data().to_rdbms(
        host="127.0.0.1",
        rdbms="mysql",
        database="test_example",
        username="******",
        password_file="{0}/rdbms.password".format(BASE_DIR)
    ).table(
        table="second_table_name",
        columns=["name", "count"]
    ).from_hdfs(
        export_dir="{0}/data_to_export".format(BASE_DIR)
    )
    _sqoop_export_job_.run()
Esempio n. 3
0
 def test_export_batch_with_hadoop_properties(self):
     self.assertEquals(
         Sqoop.export_data().to_rdbms(
             rdbms="mysql",
             username="******",
             password_file="/user/cloudera/password",
             host="localhost",
             database="sqoop_tests"
         ).table(
             table="table_name"
         ).with_hadoop_properties(
             some_properties="10"
         ).with_batch().from_hdfs(
             export_dir="some"
         ).build(),
         '-Dsome.properties=10 --connect jdbc:mysql://localhost/sqoop_tests --username root --password-file /user/cloudera/password --export-dir some --table table_name --batch')
Esempio n. 4
0
 def test_export_without_export_dir(self):
     with self.assertRaises(Exception):
         Sqoop.export_data().to_rdbms(rdbms="mysql", username="******", password_file="/user/cloudera/password",
                                      host="localhost", database="sqoop_tests").table(
             table="table_name").from_hdfs().build()