Posts

Showing posts with the label sam

Migrate SQLPrompt Snippets to VSCode

 I love snippets; love em. And I have a whole bunch in RedGate SQL Prompt. Now I want to be able to use those in VSCode as well, but boy do I dread having to retype all of them. Solution? Python! First arg is the path where your SQLPrompt snippets are Second arg is the directory where you want it to spit out a "sql.json" file with all your snippets. """ A script to translate sqlprompt snippet files to vscode formatted snippets """ import os import json import glob import io import argparse class SQLPromptPlaceholder :     """Represents the values of a SQLPrompt placeholder"""     def __init__ ( self , name , default_value ):         self . name = name         self . default_value = default_value class SQLPromptSnippet :     """Represents the content of a SQLPrompt snippet"""     @ staticmethod     def from_file ( filename ):         """Generates an instance fr...

Custom AWS Lambda Layer using NodeJS

Image
AWS Lambda is awesome, and conceptually, layers are awesome too. Layers are a way to share code between lambdas. However I found the documentation on them a little spartan, and some very core use cases were barely documented at all. What I'm going to do in this blog post is walk you through how to: Create a NodeJS Layer with a custom function in it Create a NodeJS Lambda which consumes that layer And I'm going to do it using SAM. Prerequisites: - VSCode - SAM CLI Creating your Project We're going to make a simple app which contains a layer we wish to reuse across a number of lambda functions (even though we'll just do one here). The layer will export a function which reverses a string provided. We'll then create a lambda function which uses that lambda function and passes data form its input event to the function exported by the layer. I'm going to use SAM CLI for this, but really the only thing I'm gaining from that is to stub out a SAM template for me. You...