Pluck a particular field by giving the pluck keyword argument in frappe.db.get_list does not work

frappe.db.get_list(‘Employee’, pluck=‘name’)

Pluck does not seems to work.

Hi @Darshan_Patel1,

It’s worked properly.

Also, check the Database API.

Thank You!

1 Like

@NCP not sure, why it is not working in my case, (bench version : 5.0.0 & frappe v12)

I haven’t any idea if it is worked on version 12 or not but it’s worked on version-13 and 14.

Thank You!

  1. check if you are using correct --site
    bench use example.com
  2. Employee doctype is created in that --site
  3. and you have migrated
    bench migrate

NOTE:
it should work as you we are in console
and you have admin permissions
but then also try this for debug and understanding more

trying using get_all just to testing in case

# Since User doctype is created by default so see if this is working
frappe.db.get_list('User', pluck='name')
frappe.db.get_all('User', pluck='name')

frappe.db.get_all('Employee', pluck='name')

# all try this it works same ... but diff in syntax
frappe.get_list('User', pluck='name')
frappe.get_all('User', pluck='name')

frappe.get_all('Employee', pluck='name')