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

[FEATURE REQUEST] Being able to put the query in a separate .soql file #900

Closed
thvd opened this issue Oct 4, 2024 · 5 comments
Closed
Assignees
Labels
feature-request New feature request or a change in the existing functionality postponed Will be reviewed again later

Comments

@thvd
Copy link

thvd commented Oct 4, 2024

I am frustrated to put the query (with many fields) in the export.json file on one line.

Describe the solution you'd like

So just like sf data export tree i would like to use the query in a formatted way in a myQuery.soql file.

Like this:

export.json:

{
  "objects": [
    {
      "query": "config/data/testdata.soql",
      "operation": "Upsert"
    }
  ]
}

config/data/testdata.soql:

SELECT Id, 
   Name
FROM Account
LIMIT 10

How to implement this

I have been looking at the code, i think if we put this code:

    if (query.endsWith('.soql') && fs.existsSync(query)) {
      query = fs.readFileSync(query, 'utf8');
    }

in the _parseQuery method of src/modules/models/script_models/scriptObject.ts will that implement this?

@thvd thvd added the feature-request New feature request or a change in the existing functionality label Oct 4, 2024
@hknokh
Copy link
Collaborator

hknokh commented Oct 4, 2024

Hello, @thvd

Thank you for your feature request.
I will review it as soon as possible and provide updates as they become available.

Cheers

@hknokh2
Copy link
Contributor

hknokh2 commented Oct 6, 2024

Hey,
The setup() method, which includes the _parseQuery() method, is being called multiple times on modified and internally created object configurations, not just on the one defined in export.json. This makes the implementation more complex than simply reading from the disk.
Could you explain the use case ?

Copy link

This case has been marked as 'to-be-closed', since it has no activity for the 3 days.
It will be automatically closed in another 3 days of inactivity.

@github-actions github-actions bot added the to-be-closed The issue is about to be closed label Oct 10, 2024
@hknokh hknokh added postponed Will be reviewed again later and removed to-be-closed The issue is about to be closed labels Oct 11, 2024
@hknokh
Copy link
Collaborator

hknokh commented Oct 11, 2024

This case is postponed for the future review and closed for the current moment.

@hknokh hknokh closed this as completed Oct 11, 2024
@thvd
Copy link
Author

thvd commented Oct 17, 2024

Hey, The setup() method, which includes the _parseQuery() method, is being called multiple times on modified and internally created object configurations, not just on the one defined in export.json. This makes the implementation more complex than simply reading from the disk. Could you explain the use case ?

@hknokh
Hey, of course i will explain the use case.

So the challenge I experience is that the query JSON node becomes hard to maintain with a large query.
Let's say you will fetch 20 (or more) fields and you add a large WHERE clause, then I fear I need to put the whole query on one line in the JSON. This makes it hard to read and maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request or a change in the existing functionality postponed Will be reviewed again later
Projects
None yet
Development

No branches or pull requests

3 participants