Sign inSign up

jodurpar/dssqlgraphqlapi

By jodurpar

Updated almost 4 years ago

Graphql api to query sqlserver objects

Image
0

299

jodurpar/dssqlgraphqlapi repository overview

DSsqlgrahqlapi.Test

This project is a test. This api query SqlServer instances to retrieve information from databases, stored procedures, functions, tables, indexes, who accesses a table or where certain procedures or functions are used.

NEXT: Retrieve which stored procedures update or insert a column in a table and who queries them

Contains experimental features for use in other production apis. Made with:

  • Typescript
  • Mercurius
  • mssql
  • fastify

run container into docker desktop, portainer o with docker run

The playground runs at - host.docker.internal:51240/graphiql

First of all: conect to your SqlServer and database:

query DatabaseReconnect { DatabaseReconnect(server: ".", database: "test") { Text } }

There are two utils functions - UseThisFunction(name: "CalculateCustomerPrice") : Returns all stored procedures that uses function or stored procedures

  • TableAcesses : Return all stored procedures that access a table. You an query ba all access or select "all, insert, update or delete", default is all. (you must exclude any of theese by add exclamation first character (!update)

#examples

In Query bodys you can include all data needes, this is only one example. The complete list of data can yo see in docs section in the playground (upper-right corner)

query DatabaseReconnect { DatabaseReconnect(server: "host.docker.internal", database: "test") { Text } } query DatabaseReconnect { DatabaseReconnect(server: "host.docker.internal") { Text } }

query DatabaseReconnect { DatabaseReconnect(database: "test") { Text } }

query AllDatabases { AllDatabases { name } }

query SqlserverVersion { SqlserverVersion(servers: ["server1","server2"]) { server version } } query FindColumn { FindColumn(name: "ColumnName") { table_name column_name } }

query AllStoredProcedures { AllStoredProcedures { schema_name name id crdate } }

query OneStoredProcedure{ OneStoredProcedure(name: "ProcedureName") { Text } }

query AllViews { AllViews { schema_name name id crdate } }

query OneView{ OneView(name: "ViewName") { Text } }

query AllTables { AllTables { TABLE_NAME } }

query OneTable { OneTable( name: "TableName") { TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH } }

query TableIndex { TableIndex(name : "TableName") { index_name index_description index_keys } }

query AllFunctions { AllFunctions { extended_name Dependencies } }

query OneFunction { OneFunction(name: "FuctionName") { Text } }

query TableAcesses { TableAccesses(name: "TableName") { name type_desc create_date } }

query UseThisFunction { UseThisFunction(name: "Fuction or SP name") { name type_desc create_date } }

Tag summary

Content type

Image

Digest

sha256:08adbd2d0

Size

67.5 MB

Last updated

almost 4 years ago

docker pull jodurpar/dssqlgraphqlapi