# How can we run management command as celery periodic task

**URL:** <https://forum.codewithmosh.com/t/how-can-we-run-management-command-as-celery-periodic-task/10347>\
**Category:** Django\
**Created:** [January 31, 2022, 2:28pm UTC](https://forum.codewithmosh.com/t/how-can-we-run-management-command-as-celery-periodic-task/10347 "2022-01-31T14:28:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![venqics](https://avatars.discourse-cdn.com/v4/letter/v/ee59a6/32.png) [@venqics](https://forum.codewithmosh.com/u/venqics)\
**Post date:** [January 31, 2022, 2:28pm UTC](https://forum.codewithmosh.com/t/how-can-we-run-management-command-as-celery-periodic-task/10347/1 "2022-01-31T14:28:45Z")

</div>

Hi there.

I have an application where I have to schedule management command for periodic entering data into database at a regular time interval daily using cron. So my main question is how to connect this management command in order to run by celery workers that is by using celery beat.

 ![add_data.py](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/6/6c596164cc2febfb438200abb478b00343e54b43.png)

Plus, I have one more concern that can be a topic of its own but still needing your help to resolve. I have implemented management command to enter data into database using pandas and to\_sql function into my local mysql storage. But I have an issue here is to how to add a validation logic for that incoming data to eliminate or avoid insertion of duplicate entries wrt to a field. For example in my case I have product model with fields of title and unit\_price, so I will check for not creating duplicate product entries again with same product name or title.

Please explain for this and thanks for your kind assistance.
