Giter VIP home page Giter VIP logo

heroku-connect-plugin's Introduction

Heroku Connect CLI Plugin

Install

$ heroku plugins:install heroku-connect-plugin

Help

heroku help connect 

Commands

heroku connect:db:set                  - Set database parameters
heroku connect:diagnose                - Display diagnostic information about a connection
heroku connect:export                  - Export a mapping configuration JSON file
heroku connect:import FILE             - Import a mapping configuration JSON file
heroku connect:info                    - Display connection information 
heroku connect:mapping:state MAPPING   - Return the state of a mapping
heroku connect:mapping:delete MAPPING  - Delete an existing mapping
heroku connect:mapping:reload MAPPING  - Reload a mapping's data from Salesforce
heroku connect:pause                   - Pause a connection
heroku connect:resume                  - Resume a connection
heroku connect:restart                 - Restart a connection
heroku connect:sf:auth                 - Authenticate a connection to Salesforce
heroku connect:state                   - Return the state flag for a single connection

Examples

Download an existing mapping configuration

$ heroku connect:export
Saved config-file: app-name-resource-name.json

Tutorial

Make sure you have a Heroku app, with a Postgres database attached

Add the Heroku Connect add-on to your app

$ heroku addons:create herokuconnect

Link the new connection (the Heroku Connect add-on instance) to your Heroku user

$ heroku connect:info

Now link the connection to the database, specifying the config var and schema name

$ heroku connect:db:set --db=DATABASE_URL --schema=salesforce
settings database parameters... done
db_key:      DATABASE_URL
schema_name: salesforce

If either option is not supplied, this command will ask for a value.

Authorize the connection to access your Salesforce organization

$ heroku connect:sf:auth
Launching Salesforce for authorization. If your browser doesn't open, please copy the following URL to proceed:

https://login.salesforce.com/services/oauth2/authorize?…

This will launch your browser for an interactive authorization session.

Verify that connection is now in 'IDLE' state

$ heroku connect:state
IDLE

Now restore the exported configuration

This could be exported using the connect:export command or directly through the Heroku Connect dashboard. By editing this configuration file, you can add and edit existing mappings easily.

$ heroku connect:import app-name-resource-name.json
Upload complete

If you need to delete a mapping after the configuration has been imported, you can use a separate command for that:

$ heroku connect:mapping:delete Contact

Connect to your database to see the data

$ heroku pg:psql
> select * from salesforce.contact;

Contributing

Read the following:

heroku-connect-plugin's People

Contributors

alouie-sfdc avatar cafreeman avatar codingjoe avatar dependabot[bot] avatar fivetanley avatar gulopine avatar iamjem avatar jdx avatar jheikes515 avatar kennyp avatar kenyaplenty avatar lambacck avatar mattrothenberg avatar mimen avatar scottpersinger avatar sigmavirus24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-connect-plugin's Issues

add -x or similar command to get deep=true info

It would be great if there was a way to pass a flag to connect:info to get the rest of the information that comes with deep=true. This would be especially handy for the case of having to use sudo to get at customer info like row counts without having to fight with API tokens and curl.

Db-set command not working

Hi, I'm currently using your plugin and it is very useful! :)
but when I try to use db-set command I always get an error before trying to set the database.
Screen Shot 2020-02-10 at 13 31 40

However, I could do it through the endpoint using directly curl.

It seems to me that the problem is on this method fetchKeys and maybe the error was introduced when doing this change on the db-set.js file but I'm not completely sure.
Screen Shot 2020-02-10 at 13 34 58

I wanted to let you know about it. Thanks in advance!

Move commands to top-level commands directory

It seems that the current best practice for heroku cli plugins is to use a top level commands and a top-level lib directory that contains the helper utilities for the commands. Currently our commands directory is under lib.

Add a connect:list command

Currently, connect:info lists very basic information about every Heroku Connect connection on an app. With #67, that'll be harder to make readable, and I'm not convinced this is a good idea anyway. Instead, we should add a separate connect:list command that lists all the connections using a table, something like this:

<customer's defined name> | <our guid> | <resource name>

Capture useful trigger log queries

There's lots of useful queries for exploring the trigger log table that we seem to provide to customers regularly. If we could capture those in CLI commands that could be really useful.

Cannot read property 'length' of undefined

Hello,

I'm trying to diagnose the connection as described in here, by running heroku connect:diagnose --verbose, but it returns an error

Diagnosing connection... done

=== Connection: magellan-jets-api
▸    Cannot read property 'length' of undefined

Here is a workaround I received from support heroku connect:mapping:diagnose user

Upgrade to the v6 structure

Heroku CLI v6 plugins use a very different code format for defining commands and command options. We should upgrade to this structure as well, to start taking advantage of newer features.

In particular, command flags can now be complicated pieces of functionality that can intelligently choose defaults, interactively prompt for options and provide custom objects to the rest of the function. The app flag is a good example of this, and can serve as a template for how we can reimplement our resource flag, and perhaps contribute it back to the core codebase once we have a good implementation.

Add --json to commands where appropriate

Other CLI commands offer a --json option to dump API output directly to the console, where it can be consumed by tools like jq for more advanced scripting. We should do that at least with connect:info, and other commands as appropriate.

Add mapping validation

Hi,

currently when you import a new mapping, there is not way to know if it will actually work or not. The mapping will always be accepted and eventually your connection state will switch to error.

That behavior makes deployments ever so more risky. Therefore I would suggest to add a new command, something like connect:validate FILE to send a file via API and wait for a response if the mapping could be successfully applied based on the connected Salesforce instance.

I am aware that there are certain limitations that can not easily be overcome, due to the Salesforce API.
But the Heroku Connect interface has a fairly good understanding of the Object and fields structure of the salesforce instance. It is also aware of certain constrains and even displays warnings.

I would assume that this information could be made accessible via the API. But I would suggest to keep it simple. Any kind of validation is better then none. This would be our priority list:

  1. Objects and Fields exist
  2. Required fields are in the mapping
  3. Required indexes are added
  4. Polling is not available

I hope that helps a bit, we would certainly appreciate such a feature. We could build the plugin part, but you guys need to provide the API.

Best
-Joe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.