Search code examples
sql-serverpymssqlkedro

Kedro can not find SQL Server table


I have these two datasets defined:

flp_test_query:
  type: pandas.SQLQueryDataSet
  credentials: dw_dev_credentials
  sql: select numero from dwdb.dwschema.flp_tst
  load_args:
    index_col: [numero]

flp_test:
  type: pandas.SQLTableDataSet
  credentials: dw_dev_credentials
  table_name: flp_tst
  load_args:
    index_col: ['numero']
    columns: ['numero']
  save_args:
    if_exists: 'append'

However, I only manged to get flp_test_query working, as when I try to access flp_tst I get this error:

ValueError: Table flp_tst not found

I did try to define table name as table_name: dwschema.flp_tst and table_name: dwdb.dwschema.flp_tst but all trew the same error. What am I missing?


Solution

  • From the docs it looks like you can specify the schema in load_args, eg

      load_args:
        index_col: ['numero']
        columns: ['numero']
        schema: 'dwschema'
    

    or

    load_args = {"schema","dwschema"}
    data_set = SQLTableDataSet(table_name=table_name,
                               credentials=credentials,
                                load_args=load_args)