diff --git a/grammar/src/main/antlr/LcaLang.g4 b/grammar/src/main/antlr/LcaLang.g4 index a78d4b80..e292df9d 100644 --- a/grammar/src/main/antlr/LcaLang.g4 +++ b/grammar/src/main/antlr/LcaLang.g4 @@ -35,16 +35,13 @@ globalAssignment dataSourceDefinition : DATASOURCE_KEYWORD dataSourceRef LBRACE ( - locationField | primaryKeyField | schema | block_meta + locationField | schema | block_meta )* RBRACE ; locationField : LOCATION EQUAL STRING_LITERAL ; -primaryKeyField - : PRIMARY_KEY EQUAL STRING_LITERAL - ; schema : SCHEMA_KEYWORD LBRACE columnDefinition* diff --git a/grammar/src/main/kotlin/ch/kleis/lcaac/grammar/CoreMapper.kt b/grammar/src/main/kotlin/ch/kleis/lcaac/grammar/CoreMapper.kt index cf955d05..bb00ddcd 100644 --- a/grammar/src/main/kotlin/ch/kleis/lcaac/grammar/CoreMapper.kt +++ b/grammar/src/main/kotlin/ch/kleis/lcaac/grammar/CoreMapper.kt @@ -369,7 +369,6 @@ class CoreMapper( fun dataSourceDefinition(ctx: LcaLangParser.DataSourceDefinitionContext): EDataSource { val name = ctx.dataSourceRef().uid().ID().innerText() val location = ctx.locationField().firstOrNull()?.STRING_LITERAL()?.innerText() - val primaryKey = ctx.primaryKeyField().firstOrNull()?.STRING_LITERAL()?.innerText() val schemaBlock = ctx.schema().firstOrNull() ?: throw LoaderException("missing schema in datasource $name") val schema = schemaBlock.columnDefinition().associate { column -> val key = column.columnRef().innerText() @@ -387,7 +386,6 @@ class CoreMapper( DataSourceConfig( name = name, location = location, - primaryKey = primaryKey, options = options, ) ), diff --git a/grammar/src/test/kotlin/ch/kleis/lcaac/grammar/CoreMapperTest.kt b/grammar/src/test/kotlin/ch/kleis/lcaac/grammar/CoreMapperTest.kt index 5fe89cbb..ac7cf3e1 100644 --- a/grammar/src/test/kotlin/ch/kleis/lcaac/grammar/CoreMapperTest.kt +++ b/grammar/src/test/kotlin/ch/kleis/lcaac/grammar/CoreMapperTest.kt @@ -196,7 +196,6 @@ class CoreMapperTest { val ctx = LcaLangFixture.parser(""" datasource source { location = "file.csv" - primary_key = "geo" schema { mass = 1 kg geo = "FR" @@ -216,7 +215,7 @@ class CoreMapperTest { config = DataSourceConfig( name = "source", location = "file.csv", - primaryKey = "geo", + primaryKey = "id", options = mapOf( "description" to "This is a description", )