OSS のETL/ELT ツールEmbulk のJDBC Plugin を使って、FinancialForce データを簡単にDM に同期する方法。
Embulk は、大量のデータをDB、クラウドデータストア、DWH にロードできるオープンソースETL ツールです。近頃のトレンドでは、1社で複数のオンプレアプリやSaaS を使っており、データ分析にはETL/ELT ツールを使ってデータを丸ごとDB/DWH にロードしてから、分析やビジュアライズをすることが主流になっています。Embulk には、いろいろなプラグインがあり、多様なInput とOutput 処理をサポートしています。この記事では、Embulk のJDBC Input Plugin と CData Drivers for FinancialForce を使って、FinancialForce のデータを簡単にDB にロードします。この例ではロード先のDB にはMySQL を使います。

※製品について詳しい情報をご希望の方は以下からお進みください。
- FinancialForce にほかのBI、ETL、開発ツールから接続したい:FinancialForce データ連携ガイドおよびチュートリアルのリストへ
- FinancialForce Drivers について詳細を知りたい:ドライバー詳細情報ページへ
- ほかのデータソースに連携したい:CData Drivers 一覧へ
- ドライバーの30日の無償トライアル版を使いたい:トライアル版ダウンロードページへ
- 製品の利用やライセンスについて相談したい:sales@cdata.co.jp までメールにてご相談ください。
Embulk でCData JDBC Driver for FinancialForce データをロード
- CData JDBC Driver for FinancialForce をEmbulk と同じマシンにインストールします。
-
以下のパスにJDBC Driver がインストールされます。後ほどこのパスを使います。
C:\Program Files\CData\CData JDBC Driver for FinancialForce 2019J\lib\cdata.jdbc.financialforce.jar
- 次に、EmbulkとCData JDBC Driverをつなぎこむための、JDBC Input Plugin をインストールします。
https://github.com/embulk/embulk-input-jdbc/tree/master/embulk-input-jdbc - 今回はロード先DB としてMySQL を使います。ほかにもSQL Server、PostgreSQL、Google BigQuery などを使うことも可能です。
https://github.com/embulk/embulk-output-jdbc/tree/master/embulk-output-mysqlembulk gem install embulk-output-mysql
- config ファイルを作成し、FinancialForce -> MySQL のジョブを作成します。financialforce-mysql.yml というファイル名で作成しました。
embulk gem install embulk-input-jdbc
in:
type: jdbc
driver_path: C:\Program Files\CData\CData JDBC Driver for FinancialForce 2019J\lib\cdata.jdbc.financialforce.jar
driver_class: cdata.jdbc.financialforce.FinancialForceDriver
url: jdbc:financialforce:User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=REFRESH
table: "Account"
out:
type: mysql
host: localhost
database: DatabaseName
user: UserId
password: UserPassword
table: "Account"
mode: insert
There are several authentication methods available for connecting to FinancialForce: login credentials, SSO, and OAuth.
Authenticating with a Login and Token
Set the User and Password to your login credentials. Additionally, set the SecurityToken. By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses.
To disable the security token:
- Log in to FinancialForce and enter "Network Access" in the Quick Find box in the setup section.
- Add your IP address to the list of trusted IP addresses.
To obtain the security token:
- Open the personal information page on FinancialForce.com.
- Click the link to reset your security token. The token will be emailed to you.
- Specify the security token in the SecurityToken connection property or append it to the Password.
Authenticating with OAuth
If you do not have access to the user name and password or do not want to require them, use the OAuth user consent flow. See the OAuth section in the Help for an authentication guide.
Connecting to FinancialForce Sandbox Accounts
Set UseSandbox to true (false by default) to use a FinancialForce sandbox account. Ensure that you specify a sandbox user name in User.
embulk run financialforce-mysql.yml
クエリ条件でフィルタリングしたデータのロード
ちなみに、上記の例ではテーブル名を直接指定しましたが、以下のようにSQL Queryを書いてもいいです。 Where句で作成日や修正日を指定すれば、最新のデータだけを対象にすることも可能です。
in:
type: jdbc
driver_path: C:\Program Files\CData\CData JDBC Driver for FinancialForce 2019J\lib\cdata.jdbc.financialforce.jar
driver_class: cdata.jdbc.financialforce.FinancialForceDriver
url: jdbc:financialforce:User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=REFRESH
query: "SELECT BillingState, Name FROM Account WHERE [RecordId] = 1"
out:
type: mysql
host: localhost
database: DatabaseName
user: UserId
password: UserPassword
table: "Account"
mode: insert
CData JDBC Driver for FinancialForce をEmbulk で使うことで、FinancialForce コネクタとして機能し、簡単にデータを取得して同期することができました。ぜひ、30日の無償評価版 をお試しください。