Skip to content

datastore_info does not return all available datastore info #5831

Closed
@jqnatividad

Description

CKAN version
2.9.1

Describe the bug
datastore_info "returns information about the data imported, such as column names and types.". For example:

$ ckanapi action datastore_info id=5ab4b4de-c970-4619-ab55-ce4338535b24 -r https://data.boston.gov
{
  "meta": {
    "count": 1268020
  },
  "schema": {
    "Agency": "text",
    "DateEntered": "text",
    "Developer": "text",
    "GeneralContractor": "text",
    "MINOR": "text",
    "ProjectAddress_1": "text",
    "ProjectName": "text",
    "ProjectNeigborhood": "text",
    "RESIDENT": "text",
    "Race_Desc": "text",
    "SEX": "text",
    "SubContractor": "text",
    "SubContractorAddress_1": "text",
    "SubContractorAddress_2": "text",
    "TotalHours": "text",
    "Trade": "text"
  }
}

However, it doesn't return other relevant available datastore information like aliases and the data dictionary.

Currently, to get an alias, you need to query a special view _table_metadata. To get the data dictionary, you need to call datastore_search.

Expected behavior
Instead of fetching datastore information for a given resource from three different areas, expand
datastore_info so that it also returns the resource's aliases and its data dictionary in addition to what it returns now,

Having the actual data type as stored in the database, and the logical datatype as described by the data dictionary is also useful for Datastore API users. Returning if a column is indexed is also useful for developers who are using datastore_search_sql so they can create performant SQL queries.

Additional details
This will facilitate implementing #5801. It will also help CKAN Datastore API users who are using the datastore to create efficient reports/visualizations and extensions.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions