Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salesforce - Improved Reliability #1597

Merged
merged 1 commit into from
Mar 16, 2016
Merged

Conversation

dlstadther
Copy link
Collaborator

Made use of python TempFile rather than keeping (potentially) large lists of lists of OrderedDicts in memory.

Moved parse_results() and _parse_results() to be global functions. Call these functions on each page of salesforce results within query_all().

Regex now matches case insensitive when extracting field names from soql query.

Recursive get_all_responses() inner function has been replaced by the iterative equivalent (deep recursion was causing a segmentation fault).

Usage looks like the following:

import luigi
from luigi import configuration
from luigi.contrib import salesforce

config = configuration.get_config()

class Main(luigi.WrapperTask):
   def requires(self):
       yield SalesforceQuery(
           object_name='Account',
           output_path='/path/to/sf/query.csv',
           soql='select id from Account',
           is_soql_file=False
       )

class SalesforceQuery(salesforce.QuerySalesforce):
    object_name = luigi.Parameter()
    use_sandbox = luigi.BoolParameter(default=False)
    sandbox_name = luigi.Parameter(default=None)
    output_path = luigi.Parameter()
    soql = luigi.Parameter()
    is_soql_file = luigi.BoolParameter()

    def output(self):
        return luigi.LocalTarget(self.output_path)

if __name__ == "__main__":
    luigi.run(['Main'])

…entation faults due to massive recursion and extremely large datasets from salesforce.
erikbern added a commit that referenced this pull request Mar 16, 2016
Salesforce - Improved Reliability
@erikbern erikbern merged commit df8783b into spotify:master Mar 16, 2016
@dlstadther
Copy link
Collaborator Author

@erikbern No questions/comments/etc?

@erikbern
Copy link
Contributor

I trust that you know what you are doing :)

@erikbern
Copy link
Contributor

Changes to stuff in contrib isn't as critical. I doubt the salesforce integration is something a lot of people use

@dlstadther dlstadther deleted the sf-patch branch March 16, 2016 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants