question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI support for Stored Procedures

See original GitHub issue

PR #624 adds a feature for exposing Stored Procedures through REST APIs.

Links: Design Doc, RFC

A new option is required in CLI along with add command to be able to add a stored procedure.

The config file for declaring a stored procedure looks like below.

"GetBooks": {
      "source": {
        "type": "stored-procedure",
        "object": "get_books"
      },
      "rest": true,
      "graphql": false,
      "permissions": [
        {
          "role": "authenticated",
          "actions": [ "*" ]
        }
      ]
    },
    "GetBook": {
      "source": {
        "type": "stored-procedure",
        "object": "get_book_by_id"
      },
      "rest": true,
      "graphql": false,
      "permissions": [
        {
          "role": "authenticated",
          "actions": [ "*" ]
        }
      ]

As per RFC, this is the definition for the source field in a stored procedure

"type": {
    "type": "string",                                            
    "enum": [ "table", "view", "stored-procedure" ],
    "description": "Database object type"     
},
"object": {
    "type": "string",
    "description": "Database object name"
},
"parameters": {
    "type": "object",
    "description": "Dictionary of parameters and their values",

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Aniruddh25commented, Sep 13, 2022
  1. Do we support Paramerters and KeyFields? => Paramerters supported only when type is stored procedure, KeyFields supported otherwise - but not mandatory.
  2. Is sourceName the only mandatory field? => if source is a string, then yes, that’s the only mandatory field. if its an object, both type and object are mandatory. The name property is actually called object in the schema. Please confirm with Davide about nomenclature.
  3. An example of what values can KeyFields take? only array of strings? if yes can we change the type from Array to string[] => sure, in implementation we can do string[].

i feel like we should then remove --source

This is dangerous, we should make sure, CLI is backward compatible. No removals after releasing. We haven’t released publicly yet so we could be fine but lets keep in mind backward compatibility.

0reactions
abhishekkumamscommented, Sep 13, 2022

also, i feel like we should then remove --source, and have only one mandatory field --source.name. it will always take string as input.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calling stored procedures from CLI applications
The CLI driver supports calling stored procedures with parameter markers. Initialize the application variables that correspond to the IN, INOUT, and OUT ...
Read more >
Command line stored procedures
Stored procedures are provided for the command line interface to obtain information about the jobs and schedules configured in the Job Scheduler database....
Read more >
sql - Generating the stored procedures from command line
I want to generate Scripts i.e. Stored procedures and user defined functions from SQL server 2005. I have done it through SQL management...
Read more >
Install Extended Stored Procedures (XSP) CLI Commands
SQL Safe provides you with CLI commands to help you manually install SQL Server extended stored procedures (XSP) for SQLsafe.
Read more >
How to call a stored procedure from command line
I am on windows 2003 and SQL server 2000. I have a stored procedure "XYZ" which accepts input parameters "P", "Q". Can anyone...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found