# Validation Store and Expectation store in MS SQL

**URL:** <https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499>\
**Category:** Archive\
**Tags:** help-wanted\
**Created:** [November 16, 2020, 1:21pm UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499 "2020-11-16T13:21:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcv](https://avatars.discourse-cdn.com/v4/letter/p/51bf81/32.png) [@pcv](https://discourse.greatexpectations.io/u/pcv)\
**Post date:** [November 16, 2020, 1:21pm UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499/1 "2020-11-16T13:21:20Z")

</div>

Hi there,

I’m trying to set up Great Expectations so that it stores Expectation definitions and validation results in a Microsoft SQL database.  
I can set up MS SQL as a datasource - that works great.  
I’ve tried setting up PostgreSQL as a Expectations Store and Validations Store and that works too.

These are the stores in my great\_expectations.yml:  
stores:  
expectations\_db\_store:  
class\_name: ExpectationsStore  
store\_backend:  
class\_name: DatabaseStoreBackend  
credentials: ${mssql}  
validations\_db\_store:  
class\_name: ValidationsStore  
store\_backend:  
class\_name: DatabaseStoreBackend  
credentials: ${mssql}

expectations\_store\_name: expectations\_db\_store  
validations\_store\_name: validations\_db\_store

This is my config\_variables.yml:  
mssql:  
url: mssql+pyodbc://XXX:XXX@XXX.database.windows.net:1433/XXX?driver=ODBC  
Driver 17 for SQL Server&charset=utf&autocommit=true

When I try to do just `great_expectations store list` it complains that there is no drivername. When I add `drivername: mssql+pyodbc`, it says ` __init__ () got an unexpected keyword argument 'url'`.

It seems to me that MS SQL credentials can’t be configured using the drivername/host/… format and can only be configured through `url`. However it looks like the `DatabaseStoreBackend` only supports the drivername/host/… format.

Is this the case or am I doing something wrong? I see you’re using SQL alchemy for both datasources and stores, so it sounds like it should work somehow.

Thanks,

Petr

---

<div class="post-metadata">

**Author:** ![eugene.mandel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/eugene.mandel/32/22_2.png) [@eugene.mandel](https://discourse.greatexpectations.io/u/eugene.mandel)\
**Post date:** [November 19, 2020, 10:04pm UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499/2 "2020-11-19T22:04:07Z")

</div>

@pcv, Great Expectations uses SQLAlchemy to connect to all the databases. Could you please test if you can successfully use your URL with SQLAlchemy (independently of GE)? Thank you!

---

<div class="post-metadata">

**Author:** ![pcv](https://avatars.discourse-cdn.com/v4/letter/p/51bf81/32.png) [@pcv](https://discourse.greatexpectations.io/u/pcv)\
**Post date:** [November 20, 2020, 8:44am UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499/3 "2020-11-20T08:44:38Z")

</div>

@eugene.mandel Yes, I can connect to MS SQL using SQLAlchemy with that URL. I can even connect to the database from Great Expectations if I set it up as a datasource. But it doesn’t work as a Expectations Store and Validations Store.  
Thank you for looking into that!

---

<div class="post-metadata">

**Author:** ![nok](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@nok](https://discourse.greatexpectations.io/u/nok)\
**Post date:** [November 20, 2020, 3:09pm UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499/4 "2020-11-20T15:09:11Z")

</div>

IS `url` an argument you pass for your db credentials? I tried Oracle and I find the varchar max length would be a limitation, not sure if MS SQL support large enough varchar too?

---

<div class="post-metadata">

**Author:** ![eugene.mandel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/eugene.mandel/32/22_2.png) [@eugene.mandel](https://discourse.greatexpectations.io/u/eugene.mandel)\
**Post date:** [November 22, 2020, 10:09am UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499/5 "2020-11-22T10:09:35Z")

</div>

@pcv Thank you for answering my question. If the URL works for you with SQLAlchemy (and in other contexts of GE), but not in the stores, I consider it a bug. Could you please file it as a GitHub issue: [https://github.com/great-expectations/great\_expectations/issues](https://github.com/great-expectations/great_expectations/issues) ? Thank you!

---

<div class="post-metadata">

**Author:** ![pcv](https://avatars.discourse-cdn.com/v4/letter/p/51bf81/32.png) [@pcv](https://discourse.greatexpectations.io/u/pcv)\
**Post date:** [November 23, 2020, 1:45pm UTC](https://discourse.greatexpectations.io/t/validation-store-and-expectation-store-in-ms-sql/499/6 "2020-11-23T13:45:25Z")

</div>

Thanks @eugene.mandel, here it is: [https://github.com/great-expectations/great\_expectations/issues/2073](https://github.com/great-expectations/great_expectations/issues/2073)
