sqlcli

command module
v0.0.0-...-f7f4b48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

SQL Server CLI utility

This CLI provides some quick shortcuts for frequent workflows by wrapping Microsoft's sqlcmd.

Commands

Query

Run arbitrary sql statements.

sqlcli query "SET NOCOUNT ON; select top 2 IdCuenta, Carpeta from accounts.cuenta"
IdCuenta                             Carpeta                                                                         
------------------------------------ --------------------------------------------------------------------------------
52893024-A0F5-4F30-A79E-00006BD75EC9 NULL                                                                            
9A76B2C2-84A1-4D87-9511-00008BE34381 NULL                                                                            
Script

Run statements from a .sql (batch) file.

sqlcli script /tmp/insert-data.sql 
(89 rows affected)
Find

Search objects (tables, views, stored procs or functions) containing text.

sqlcli find "branding"
Object Name                                             Object Type          TEXT Location     
------------------------------------------------------- -------------------- ------------------
accounts.CuentaBranding                                 BASE TABLE           Table Name        
accounts.CuentaBranding.IdCuentaBranding                COLUMN               Column Name       
accounts.CuentaBranding_TMP                             BASE TABLE           Table Name        
accounts.CuentaBranding_TMP.IdCuentaBranding            COLUMN               Column Name       
accounts.DeleteCuentaBranding                           PROCEDURE            ROUTINE_DEFINITION
accounts.GetAllCuentaBranding                           PROCEDURE            ROUTINE_DEFINITION
accounts.GetCuentaBrandingByIdCuenta                    PROCEDURE            ROUTINE_DEFINITION
accounts.GetCuentaBrandingBySubDomain                   PROCEDURE            ROUTINE_DEFINITION
accounts.InsertCuentaBranding                           PROCEDURE            ROUTINE_DEFINITION
accounts.UpdateCuentaBranding                           PROCEDURE            ROUTINE_DEFINITION
reception.getSuscripcionesByIdCuenta                    PROCEDURE            ROUTINE_DEFINITION
reception.GetVentanillasNoSuscritas                     PROCEDURE            ROUTINE_DEFINITION
selfBilling.Branding                                    BASE TABLE           Table Name        
selfBilling.deleteBrandingById                          PROCEDURE            ROUTINE_DEFINITION
selfBilling.getBrandingById                             PROCEDURE            ROUTINE_DEFINITION
selfBilling.upsertBrandingById                          PROCEDURE            ROUTINE_DEFINITION

(16 rows affected)
Get

Outputs the definition of a table, view, procedure or function

sqlcli get selfBilling.getBrandingById
CREATE PROCEDURE selfBilling.getBrandingById
(@idCuenta uniqueidentifier)
AS

SELECT 
	IdPrimaryImage   ,
	IdSecondaryImage ,
	IdBackgroundImage,
	PrimaryColor     ,
	SecondaryColor   ,
	BackgroundColor  ,
	FontColor
FROM 
	selfBilling.Branding
WHERE
	IdCuenta = @idCuenta

Installation

Download and install SqlCmd.

Compile (Go 1.14) and copy to /usr/local/bin:

make install

Configuration

Username and password authentication supported. (Integrated security support can be easily added)

cat ~/.sqlcli.yaml 
SqlCmdBinary: /usr/local/bin/sqlcmd
Server: <ip address>
Database: <default database>
Username: <myusername>
Password: <mypassword>

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL