- SQL Graph DB Setup for local development
- Introduction
- How to add SQL connection profiles in VS Code using connection string format?
- Step 1: To add a SQL connection, from SQL Server click on
Add Connectionas shown - Step 2: Provide
Server name - Step 3: Provide
Database name - Step 4: Select
Authentication type - Step 5: Provide
User name - Step 6: Provide
Password - Step 7: Select
YesforSave Password - Step 8: Provide name for
Profile Name
- Step 1: To add a SQL connection, from SQL Server click on
- Server details
- How to run SQL queries in VSCode?
- Graph SQL querying
- Azure AD authentication setup
This section aims to provide information for developers to establish connections with either the local SQL Graph DB or the Dev SQL Graph DB for their development tasks. To ensure a successful connection and facilitate your development tasks, it is essential to provide the specific server details. By following below instructions, you'll be able to seamlessly add the required connection and proceed with your development work.
In this context, we make the following assumptions:
- Visual Studio Code will serve as the preferred Integrated Development Environment (IDE) and the code is running in a Dev Container.
- SQL extensions, namely
ms-mssql.mssqlandms-mssql.sql-database-projects-vscodeare already installed in the development container.
SQL Graph design documentation can be found here.
Specific server details are provided in the later sections for reference.
-
More guidance can be found here on connection profiles.
-
If there is a connection issue, then look for this common issue.
Server name- db,1433- [Optional]
Database name- graph-data-model User name- saPassword (SQL Login)- Password from devcontainer.json fileSave Password?- Yes- [Optional]
Enter a name for this profile- graph-data-model
You can use a similar approach to connect to Azure SQL Graph DB.
If the local SQL Graph graph-data-model DB and schema is not yet created then below steps need to be executed after connection is established using VS Code SQL DB project publish feature:
-
Firstly, go to this and open the SQL DB project using VS Code or Visual Studio.
-
Right click on DB project and first
Buildto make sure there are no errors. Then Click onPublish
Make sure it runs fine and the necessary tables are installed. Make sure the Database exists, if not create it beforehand.
Here is the necessary tutorial to get started on how to run queries via VSCode.
Sample queries to find data -
SELECT * FROM
[pnide].[sheet] as sheet,
[pnide].[belongs] as belongs,
[pnide].[pnid] as pnid
WHERE MATCH (sheet-(belongs)->pnid)
AND pnid.Id = 'PNID1'
SELECT * FROM
[pnide].[Asset] as asset1,
[pnide].[Asset] as asset2,
[pnide].[Connected] as connected
WHERE MATCH (asset1-(connected)->asset2)
AND asset1.Id = 'Asset1'Tutorial to figure on how to write queries.
The code has been configured to work with either the provided connecting string or through Azure AD authentication.
If you choose to use Azure AD authentication, it is essential to set up the required roles and permissions on the SQL Graph DB resource, as outlined in the following resource: Azure SQL AD Authentication












