This page walks through importing data from Salesforce into a graph using gqldb-importer. The importer authenticates against the Salesforce REST API, runs one SOQL query per node/edge type, and streams the result records into the graph.
You need three pieces of information from Salesforce:
https://your-instance.salesforce.com.Bash./gqldb-importer -sample salesforce
A file named import.sample.salesforce.yml will be created in the current directory. Rename it before editing so a re-run of -sample salesforce doesn't clobber your changes:
Bashmv import.sample.salesforce.yml import.salesforce.yml
Edit import.salesforce.yml. Salesforce-specific configuration lives under the top-level salesforce: block; see the Import Configurations for the rest of the file (server, settings).
config snippetsalesforce: url: "https://your-instance.salesforce.com" username: "[email protected]" password: "sf_password" token: "security_token" nodes: - schema: "Account" query: "SELECT Id, Name, Industry FROM Account LIMIT 1000" id_column: "Id" edges: - schema: "CONTACT_OF" query: "SELECT Id, AccountId, Name FROM Contact LIMIT 1000" from_column: "Id" to_column: "AccountId"
Bash./gqldb-importer -c import.salesforce.yml
Each query is plain SOQL. The field names returned by SELECT are what id_column, from_column, to_column, and properties reference.
Node query — return one record per node, with one column acting as the node _id:
SQL-- Maps directly to id_column: "Id", schema: "Account" SELECT Id, Name, Industry, AnnualRevenue FROM Account WHERE Type = 'Customer'
Edge query — return one record per edge, with columns for the source and destination _ids:
SQL-- Maps to from_column: "Id", to_column: "AccountId", schema: "CONTACT_OF" SELECT Id, AccountId, Email FROM Contact WHERE AccountId != null
A few practical tips:
Id, AccountId, etc.) are already globally unique within an org — no prefix needed to avoid collisions.JOIN. To build edges between two unrelated objects, run one query per side or use Salesforce's lookup-relationship syntax (Account.Name from Contact).LIMIT / OFFSET or a WHERE Id > cursor.