pyhocon icon indicating copy to clipboard operation
pyhocon copied to clipboard

path traversal through lists

Open zar3bski opened this issue 3 years ago • 0 comments

say I have the following configuration

{
  source = [
    { 
      type = mssql
      port = 1344
      tables {
        une_table360 {
          id = "UniqueID"
          view = "someview"
        }
        une_table {
          upload = false
          view = "someview"
        }
        une_autre_table {
          query = "SELECT TOP 100 FROM une_autre_table" 
          historicity = "delta"
          view = "someview"
        }
      }
    }
  ],
}

How can I access all my tables? I tried

  • conf.get("source.0.tables.une_table360")
  • conf.get("source.[0].tables.une_table360")
  • conf["source"][0]["tables"]["une_table360"]

I get a pyhocon.exceptions.ConfigException: source does not translate to a list which I find surprising

zar3bski avatar Jun 08 '22 10:06 zar3bski