# Migration From V0 to V1

**URL:** <https://discourse.greatexpectations.io/t/migration-from-v0-to-v1/2028>\
**Category:** GX Core Support\
**Tags:** databricks, datasource\
**Created:** [December 13, 2024, 5:46pm UTC](https://discourse.greatexpectations.io/t/migration-from-v0-to-v1/2028 "2024-12-13T17:46:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jyoti\_Thakkar](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@Jyoti\_Thakkar](https://discourse.greatexpectations.io/u/Jyoti_Thakkar)\
**Post date:** [December 13, 2024, 5:46pm UTC](https://discourse.greatexpectations.io/t/migration-from-v0-to-v1/2028/1 "2024-12-13T17:46:30Z")

</div>

Hi GX Community,

I am using GX 0.15.43 and want to migrate to GX CoreV1.

We are using GX in databricks and instantiating a Data Context without a yml file. Below is the sample code

import great\_expectations as ge  
from great\_expectations.core import ExpectationSuite  
from great\_expectations.core.batch import RuntimeBatchRequest  
from great\_expectations.data\_context import BaseDataContext  
from great\_expectations.data\_context.types.base import FilesystemStoreBackendDefaults,DataContextConfig, DatasourceConfig

expectation\_suite\_config = {  
“expectation\_suite\_name”: “my\_expectation\_suite”,  
“expectations”: [ # List of expectations  
{  
“expectation\_type”: “expect\_column\_values\_to\_not\_be\_null”,  
“kwargs”: {  
“column”: “my\_column”,  
“result\_format”: {“result\_format”: “COMPLETE”}

```
        }
    }
]

```

}

my\_expectation\_suite = ExpectationSuite(\*\*expectation\_suite\_config)

# Define DataContext configuration

data\_context\_config = DataContextConfig(  
plugins\_directory=None,  
config\_variables\_file\_path= None,  
datasources={  
“my\_spark\_datasource”: DatasourceConfig(  
class\_name= “Datasource”,  
execution\_engine={  
“class\_name”: “SparkDFExecutionEngine”,  
“force\_reuse\_spark\_context”: True,

```
        },
        data_connectors={
            "spark_runtime_dataconnector":{
                "class_name": "RuntimeDataConnector",
                "module_name":"great_expectations.datasource.data_connector",
                "batch_identifiers": ["batch_name"]
            },
        },
    )
},
store_backend_defaults=FilesystemStoreBackendDefaults(root_directory="/"),

```

)

from pyspark.sql import SparkSession

# Create a SparkSession

spark = SparkSession.builder.appName(“SparkDataFrame”).getOrCreate()

# Define the data

data = [(“John”, 30), (“Anna”, 25), (“Peter”, 32)]

# Create the DataFrame

df = spark.createDataFrame(data, [“name”, “age”])

# Show the DataFrame

df.show()

batch\_request=RuntimeBatchRequest(datasource\_name=“my\_spark\_datasource”,  
data\_connector\_name=“spark\_runtime\_dataconnector”,  
data\_asset\_name=“my\_asset”,  
runtime\_parameters={“batch\_data”: df},  
batch\_identifiers={“batch\_name”: “batch\_run”})

context = ge.get\_context(project\_config=data\_context\_config)  
batch\_validator = context.get\_validator(batch\_request=batch\_request, expectation\_suite=my\_expectation\_suite)  
validation\_result = batch\_validator.validate()  
print(validation\_result)

I am facing challenges in migrating data context config object to GX V1. i am following below document for migration : [GX V0 to V1 Migration Guide | Great Expectations](https://docs.greatexpectations.io/docs/reference/learn/migration_guide)  
still didn’t find any solution.

Please help.

---

<div class="post-metadata">

**Author:** ![adeola](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@adeola](https://discourse.greatexpectations.io/u/adeola)\
**Post date:** [December 16, 2024, 3:01pm UTC](https://discourse.greatexpectations.io/t/migration-from-v0-to-v1/2028/2 "2024-12-16T15:01:57Z")

</div>

Hi there

It does not appear as though you are following the migration guide as I am seeing several references to older, deprecated methods in the code that you have submitted. I would recommend following our migration guide or using the our latest [documentation](https://docs.greatexpectations.io/docs/core/introduction/) which contains helpful code snippets in order to complete your migration.

---

<div class="post-metadata">

**Author:** ![Jyoti\_Thakkar](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@Jyoti\_Thakkar](https://discourse.greatexpectations.io/u/Jyoti_Thakkar)\
**Post date:** [December 16, 2024, 6:05pm UTC](https://discourse.greatexpectations.io/t/migration-from-v0-to-v1/2028/3 "2024-12-16T18:05:16Z")

</div>

Thank you for the reply.  
I am facing challenge in finding the code snippet for the below. I don’t see any document on migrating datacontext config object.

data\_context\_config = DataContextConfig(  
plugins\_directory=None,  
config\_variables\_file\_path= None,  
datasources={  
“my\_spark\_datasource”: DatasourceConfig(  
class\_name= “Datasource”,  
execution\_engine={  
“class\_name”: “SparkDFExecutionEngine”,  
“force\_reuse\_spark\_context”: True,

```auto
        },
        data_connectors={
            "spark_runtime_dataconnector":{
                "class_name": "RuntimeDataConnector",
                "module_name":"great_expectations.datasource.data_connector",
                "batch_identifiers": ["batch_name"]
            },
        },
    )
},
store_backend_defaults=FilesystemStoreBackendDefaults(root_directory="/"),

```

)

If you have any reference, please share
