Skip to content

Commit

Permalink
grammar: remove field primary_key
Browse files Browse the repository at this point in the history
  • Loading branch information
Peva Blanchard committed Jun 3, 2024
1 parent 4f3fb0b commit c2345b1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions grammar/src/main/antlr/LcaLang.g4
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
2 changes: 0 additions & 2 deletions grammar/src/main/kotlin/ch/kleis/lcaac/grammar/CoreMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ class CoreMapper<Q>(
fun dataSourceDefinition(ctx: LcaLangParser.DataSourceDefinitionContext): EDataSource<Q> {
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()
Expand All @@ -387,7 +386,6 @@ class CoreMapper<Q>(
DataSourceConfig(
name = name,
location = location,
primaryKey = primaryKey,
options = options,
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ class CoreMapperTest {
val ctx = LcaLangFixture.parser("""
datasource source {
location = "file.csv"
primary_key = "geo"
schema {
mass = 1 kg
geo = "FR"
Expand All @@ -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",
)
Expand Down

0 comments on commit c2345b1

Please sign in to comment.