Re: Data model design questio: graph in database

2024-02-25 Thread Jason
Question about this, why focus on using a rdbms for this functionality vs 
using an actual graph db like neo4j with neomodel 
?

On Sunday, February 25, 2024 at 7:59:31 PM UTC-5 Mike Dewhirst wrote:

> Re-reading your question perhaps I was too brief in my earlier response. 
> Let me assume all your actual edges and vertices are objects of child 
> classes. I also assume  your base Edge and Vertex classes are abstract for 
> inheritance purposes only.
>
> It doesn't matter whether instances of edges and vertices are in lists. 
> You can call obj.which_class() on any object which has (inherited) that 
> method to determine whether an edge (or vertex) is type_1 or type_2 (using 
> our previous terminology)
>
> You cannot query the database using the return value from which_class() 
> because that operates on instances not at the database level. Therefore you 
> have to retrieve edges and vertices from the database with a query which 
> fetches related rows and then filter the results afterwards. Perhaps like 
> this ...
>
> vertex_src = result_of_vertex_finder(...)
> vertex_det = result_of_vertex_finder(...)
> if vertex_src and vertex_dst:
> edges_1 = Edge_type_1.objects.filter(src=vertex_src, dst=vertex_dst) 
> or []
> edges_2 = Edge_type_2.objects.filter(src=vertex_src, dst=vertex_dst) 
> or []
> all_edges = [edges_1].extend[edges_2]
>
> if all_edges:
> edges_type_1 = [edge for edge in all_edges if edge.which_class() == 
> "type 1"]
> edges_type_2 = [edge for edge in all_edges if edge.which_class() == 
> "type 2"]
>
> On the other hand, if you want to keep all edges in the same database 
> table it might be better/simpler to add a field 'type' to the table as you 
> were originally thinking.  
>
> Cheers
>
> Mike
>
>
>
> On Sunday, February 25, 2024 at 9:47:12 PM UTC+11 Sébastien Hinderer wrote:
>
>> Dear Mike, 
>>
>> I will definitely play aroudn with your nice suggestion, but I would like 
>> to share a concern I have. At this stage I am actually unsure how this 
>> will work. 
>>
>> Indeed, suppose a vertex is given as input and one tries to query the 
>> database about all the edges that originate from this vertex. The answer 
>> will be under the form of a list of edges, but those will be of class 
>> Edge and I assume that their type method will return the Edge class 
>> and not the class associated to the actual child. 
>>
>> Likewise, once given the list of edges, one has access to the list of 
>> vertices that are neiighbourgs of the original one, but under the form 
>> of a list of objects of the base class, Vertex, with still no way to find 
>> the type of the child object that has given rise to that Vertex one. 
>>
>> Am I perhaps missing something here? 
>>
>> Many thanks in advance and apologies for th likely naïve question, 
>>
>> Seb. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80e65b9b-154b-4dd1-aeba-46ec898560ben%40googlegroups.com.


Re: Data model design questio: graph in database

2024-02-25 Thread Mike Dewhirst
Re-reading your question perhaps I was too brief in my earlier response. 
Let me assume all your actual edges and vertices are objects of child 
classes. I also assume  your base Edge and Vertex classes are abstract for 
inheritance purposes only.

It doesn't matter whether instances of edges and vertices are in lists. You 
can call obj.which_class() on any object which has (inherited) that method 
to determine whether an edge (or vertex) is type_1 or type_2 (using our 
previous terminology)

You cannot query the database using the return value from which_class() 
because that operates on instances not at the database level. Therefore you 
have to retrieve edges and vertices from the database with a query which 
fetches related rows and then filter the results afterwards. Perhaps like 
this ...

vertex_src = result_of_vertex_finder(...)
vertex_det = result_of_vertex_finder(...)
if vertex_src and vertex_dst:
edges_1 = Edge_type_1.objects.filter(src=vertex_src, dst=vertex_dst) or 
[]
edges_2 = Edge_type_2.objects.filter(src=vertex_src, dst=vertex_dst) or 
[]
all_edges = [edges_1].extend[edges_2]

if all_edges:
edges_type_1 = [edge for edge in all_edges if edge.which_class() == 
"type 1"]
edges_type_2 = [edge for edge in all_edges if edge.which_class() == 
"type 2"]

On the other hand, if you want to keep all edges in the same database table 
it might be better/simpler to add a field 'type' to the table as you were 
originally thinking.  

Cheers

Mike



On Sunday, February 25, 2024 at 9:47:12 PM UTC+11 Sébastien Hinderer wrote:

> Dear Mike,
>
> I will definitely play aroudn with your nice suggestion, but I would like
> to share a concern I have. At this stage I am actually unsure how this
> will work.
>
> Indeed, suppose a vertex is given as input and one tries to query the
> database about all the edges that originate from this vertex. The answer
> will be under the form of a list of edges, but those will be of class
> Edge and I assume that their type method will return the Edge class
> and not the class associated to the actual child.
>
> Likewise, once given the list of edges, one has access to the list of
> vertices that are neiighbourgs of the original one, but under the form
> of a list of objects of the base class, Vertex, with still no way to find
> the type of the child object that has given rise to that Vertex one.
>
> Am I perhaps missing something here?
>
> Many thanks in advance and apologies for th likely naïve question,
>
> Seb.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0b786b4c-6c95-4920-a2f9-d28c4b541eb9n%40googlegroups.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread Chuks Igbo
am interested, just wanna get more experience. 

+234 7065622729
On Sunday, February 25, 2024 at 9:10:19 AM UTC+1 Dawda Borje Kujabi wrote:

> I am interested, just wanna get more experience. 
>
> Email: dawdabor...@gmail.com 
>
> Sent from my Huawei phone
>
>
>  Original message 
> From: SURAJ TIWARI 
> Date: Sun, 18 Feb 2024, 12:04 pm
> To: Django users 
> Subject: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging 
> Project!
>
> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>
> 👋 Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in 
> Django development? Do you want to work on a meaningful project that 
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join 
> our dynamic team!
>
> 🌟 Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill 
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
> 💼 Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 🤝 How to Join: Simply reply to this message expressing your interest, 
> and we'll provide you with all the necessary details to get started on our 
> project.
>
> Let's work together to create something amazing and gain valuable 
> experience along the way! 💻✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
>  
> 
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0f063af4-e264-4c8f-92de-3dd141339fe3n%40googlegroups.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread Kintu Peter
I would wish to inform you that am intrested

On Sun, 18 Feb 2024, 19:47 SURAJ TIWARI,  wrote:

> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>
> 👋 Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in
> Django development? Do you want to work on a meaningful project that
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
> our dynamic team!
>
> 🌟 Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
> 💼 Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 🤝 How to Join: Simply reply to this message expressing your interest,
> and we'll provide you with all the necessary details to get started on our
> project.
>
> Let's work together to create something amazing and gain valuable
> experience along the way! 💻✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKsBE08eKEe-gy%2BoHoOkv_OFZ%2Be83NoNVXJ%3Da0CqBdm8woXuvA%40mail.gmail.com.


Re: I am interested. +2348162698617 Github: fosajeffRe: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread ELVIS MAKASI
Intéressant 😼

Le sam. 24 févr. 2024, 16:34, André Lewis  a
écrit :

> I'm interested. +8764608874.
>
> On Mon, 19 Feb 2024, 11:20 am Efosa Jeffrey Okooboh, <
> okoobohef...@gmail.com> wrote:
>
>> I am interested
>> On Monday, February 19, 2024 at 4:47:39 PM UTC+1 july quintero wrote:
>>
>>> Hello, I would like to be part of this work team and thus strengthen my
>>> knowledge with this great team of enthusiastic people with a lot of
>>> experience in this field of web development. Thank you very much for your
>>> attention and I will be waiting for a response.
>>>
>>>
>>> El dom, 18 feb 2024 a la(s) 11:48 a.m., SURAJ TIWARI (
>>> suraj1...@gmail.com) escribió:
>>>
 🚀 Join Our Django WhatsApp Bulk Messaging Project!

 👋 Hello everyone,

 Are you looking for an exciting opportunity to gain hands-on experience
 in Django development? Do you want to work on a meaningful project that
 leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
 our dynamic team!

 🌟 Benefits:

- Get hands-on experience working on a real-world Django project.
- Learn how to leverage WhatsApp for bulk messaging, a valuable
skill in today's digital landscape.
- Opportunities for hybrid work, allowing flexibility in your
schedule.
- Collaborate with experienced developers and gain valuable
mentorship.
- Access to cutting-edge tools and technologies.

 💼 Opportunities Available:

- Django developers
- Frontend developers
- UI/UX designers
- Quality assurance testers

 🤝 How to Join: Simply reply to this message expressing your interest,
 and we'll provide you with all the necessary details to get started on our
 project.

 Let's work together to create something amazing and gain valuable
 experience along the way! 💻✨

 Best regards,

 Suraj Tiwari


 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
 
 .

>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/35101022-f487-42c5-9ae1-74afea0ed56dn%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJN6x_h%2BQjLR9YvJHsC1Zt-OGMgjDxYJgVR5GnWmXoTEH7Q67w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACCiQ-mtmSZA3xr484m%2B9knSZKBSAJTXzvvgOfGHrnyYG9iJQA%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread Kelvin Ugwu
hello,
I am thrilled about this opportunity, and I want to declare my interest in
being part of this interesting project.
+2347084632922

On Sat, Feb 24, 2024 at 8:48 PM David James Nwoyie <
jamesnwoyieda...@gmail.com> wrote:

> Am interested in the
> +2349038924701
>
> On Sun, Feb 18, 2024, 5:48 PM SURAJ TIWARI  wrote:
>
>> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>>
>> 👋 Hello everyone,
>>
>> Are you looking for an exciting opportunity to gain hands-on experience
>> in Django development? Do you want to work on a meaningful project that
>> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
>> our dynamic team!
>>
>> 🌟 Benefits:
>>
>>- Get hands-on experience working on a real-world Django project.
>>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>>in today's digital landscape.
>>- Opportunities for hybrid work, allowing flexibility in your
>>schedule.
>>- Collaborate with experienced developers and gain valuable
>>mentorship.
>>- Access to cutting-edge tools and technologies.
>>
>> 💼 Opportunities Available:
>>
>>- Django developers
>>- Frontend developers
>>- UI/UX designers
>>- Quality assurance testers
>>
>> 🤝 How to Join: Simply reply to this message expressing your interest,
>> and we'll provide you with all the necessary details to get started on our
>> project.
>>
>> Let's work together to create something amazing and gain valuable
>> experience along the way! 💻✨
>>
>> Best regards,
>>
>> Suraj Tiwari
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKDLZAQ0%3DO414%2BzirUM%3DaFYKDy8_re47dsFJXBM-PzjuA-cOWg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACLHQ4%3DqzDmERHC8OhtrXrzKWcDUCqFcVfV5XzKzMpLtP8Kq%2Bw%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread chheee
I would love to be the parts of this project, 

On Sunday, February 18, 2024 at 11:48:37 PM UTC+7 SURAJ TIWARI wrote:

> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>
> 👋 Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in 
> Django development? Do you want to work on a meaningful project that 
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join 
> our dynamic team!
>
> 🌟 Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill 
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
> 💼 Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 🤝 How to Join: Simply reply to this message expressing your interest, 
> and we'll provide you with all the necessary details to get started on our 
> project.
>
> Let's work together to create something amazing and gain valuable 
> experience along the way! 💻✨
>
> Best regards,
>
> Suraj Tiwari
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5ae7ecf-8a64-4748-a4ff-317dbfd1d944n%40googlegroups.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread Shailesh Deo
 I am interested in joining.
+9779828797400.

On Sun, Feb 25, 2024 at 1:32 AM David James Nwoyie <
jamesnwoyieda...@gmail.com> wrote:

> Am interested in the
> +2349038924701
>
> On Sun, Feb 18, 2024, 5:48 PM SURAJ TIWARI  wrote:
>
>> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>>
>> 👋 Hello everyone,
>>
>> Are you looking for an exciting opportunity to gain hands-on experience
>> in Django development? Do you want to work on a meaningful project that
>> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
>> our dynamic team!
>>
>> 🌟 Benefits:
>>
>>- Get hands-on experience working on a real-world Django project.
>>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>>in today's digital landscape.
>>- Opportunities for hybrid work, allowing flexibility in your
>>schedule.
>>- Collaborate with experienced developers and gain valuable
>>mentorship.
>>- Access to cutting-edge tools and technologies.
>>
>> 💼 Opportunities Available:
>>
>>- Django developers
>>- Frontend developers
>>- UI/UX designers
>>- Quality assurance testers
>>
>> 🤝 How to Join: Simply reply to this message expressing your interest,
>> and we'll provide you with all the necessary details to get started on our
>> project.
>>
>> Let's work together to create something amazing and gain valuable
>> experience along the way! 💻✨
>>
>> Best regards,
>>
>> Suraj Tiwari
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKDLZAQ0%3DO414%2BzirUM%3DaFYKDy8_re47dsFJXBM-PzjuA-cOWg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKWu8z06XPtDjaKkViRzuW-Rfapq3mHNTuOTS2TzmCKkLfLScw%40mail.gmail.com.


Re: Data model design questio: graph in database

2024-02-25 Thread Mike Dewhirst
SebYour assumption is too pessimistic. The class name of the (child) instance 
will always be returned from obj.__class__If instead your method returned the 
type(obj) you would see the base class name instead of the child class 
name.Perhaps you need to establish some tests which assert what you expect. I 
find such an approach very comforting.CheersMike--(Unsigned mail from my phone)
 Original message From: Sébastien Hinderer 
 Date: 25/2/24  21:46  (GMT+10:00) To: 
django-users@googlegroups.com Subject: Re: Data model design questio: graph in 
database Dear Mike,I will definitely play aroudn with your nice suggestion, but 
I would liketo share a concern I have. At this stage I am actually unsure how 
thiswill work.Indeed, suppose a vertex is given as input and one tries to query 
thedatabase about all the edges that originate from this vertex. The answerwill 
be under the form of a list of edges, but those will be of classEdge and I 
assume that their type method will return the Edge classand not the class 
associated to the actual child.Likewise, once given the list of edges, one has 
access to the list ofvertices that are neiighbourgs of the original one, but 
under the formof a list of objects of the base class, Vertex, with still no way 
to findthe type of the child object that has given rise to that Vertex one.Am I 
perhaps missing something here?Many thanks in advance and apologies for th 
likely naïve question,Seb.-- You received this message because you are 
subscribed to the Google Groups "Django users" group.To unsubscribe from this 
group and stop receiving emails from it, send an email to 
django-users+unsubscr...@googlegroups.com.to view this discussion on the web 
visit 
https://groups.google.com/d/msgid/django-users/ZdsadQngSnjTBimQ%40om.localdomain.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65db3321.050a0220.186e4.d2a8SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Data model design questio: graph in database

2024-02-25 Thread Sébastien Hinderer
Dear Mike,

I will definitely play aroudn with your nice suggestion, but I would like
to share a concern I have. At this stage I am actually unsure how this
will work.

Indeed, suppose a vertex is given as input and one tries to query the
database about all the edges that originate from this vertex. The answer
will be under the form of a list of edges, but those will be of class
Edge and I assume that their type method will return the Edge class
and not the class associated to the actual child.

Likewise, once given the list of edges, one has access to the list of
vertices that are neiighbourgs of the original one, but under the form
of a list of objects of the base class, Vertex, with still no way to find
the type of the child object that has given rise to that Vertex one.

Am I perhaps missing something here?

Many thanks in advance and apologies for th likely naïve question,

Seb.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ZdsadQngSnjTBimQ%40om.localdomain.


Apscheduler is not running multiple jobs

2024-02-25 Thread Praveen Chaudhary
Hello, everyone

I am using an apscheduler to schedule my job in a django project. here is
code

def start():
"""
The `start` function creates a report using a scheduler to generate and
send reports based on
specified sources and schedules.
"""
logger.info(f" Started creating report")

executors = {
'default': ThreadPoolExecutor(1)
}

scheduler = BackgroundScheduler(executors=executors, daemon=True)

sources, idx_list, job_schedules, triggers = generate_report()

for source, idx, job_schedule, trigger in zip(sources, idx_list,
job_schedules, triggers):
job_id = f"daily_report_job_{source.name}_{job_schedule.pk}_{idx}"
logger.info(f" Adding job with ID: {job_id}")

try:
scheduler.add_job(
generate_and_send_report_by_source_name,
trigger=trigger,
id=job_id,
args=[source],
replace_existing=True,

)
except Exception as e:
logger.error(f" Failed to add job with ID {job_id}: {e}")

try:
if scheduler.state == 0:
scheduler.start()
except Exception as e:
logger.error(f" Scheduler failed to start: {e}")


def generate_report():
"""
The `generate_report` function retrieves active sources, iterates through
their job schedules,
creates triggers based on the schedule, and returns the sources, job
schedules, and triggers.
:return: The `generate_report` function returns four values: `sources`,
`idx_list`, `job_schedules`,
and `triggers`.
"""
sources = get_active_sources()
job_schedules = []
triggers = []

if not sources:
logger.error(" Failed to generate report. No active sources found.")
return [], [], []

idx_list = []
for idx, source in enumerate(sources, start=1):
source_job_schedules = source.job_schedule.all()

for job_schedule in source_job_schedules:
if job_schedule.day_of_week is not None:
trigger = CronTrigger(
day_of_week=job_schedule.day_of_week,
hour=job_schedule.hour,
minute=job_schedule.minute
)
else:
trigger = CronTrigger(
hour=job_schedule.hour,
minute=job_schedule.minute
)
triggers.append(trigger)
idx_list.append(idx)
job_schedules.append(job_schedule)

return sources, idx_list, job_schedules, triggers


here is the models.py
class JobSchedule(TimeStamp):
name = models.CharField(max_length=255)
day_of_week = models.IntegerField(choices=DAY_CHOICES, null=True, blank=True
)
hour = models.CharField(max_length=10, null=True, blank=True)
minute = models.CharField(max_length=10, null=True, blank=True)

class Meta:
verbose_name = "Job Schedule"
verbose_name_plural = "Job Schedules"

def __str__(self) -> str:
return f"{self.name}"


class Source(TimeStamp):
name = models.CharField(max_length=255, unique=True)
source_type = models.CharField(max_length=100, choices=SOURCE_TYPE, default=
"View")
query = models.TextField()
destinations = models.ManyToManyField(Destination, related_name=
"destinations")
job_schedule = models.ManyToManyField(JobSchedule, related_name="schedule")
is_active = models.BooleanField(default=False)

class Meta:
verbose_name = 'Source'
verbose_name_plural = 'Sources'

def __str__(self) -> str:
return f"{self.name}"




*the problem is when i create one source with two different job schedule
instance, apscheduler is adding only one job*


*here is my my log message:*
apscheduler.schedulerAdded job "generate_and_send_report_by_source_name" to
job store "default"




*but it works if i create two source instances with two different job
schedule instances. *


*What are the mistakes I am making? I have tried many times to solve this
issue but did not recognize what I am missing.*


*Prabin Chaudhary*

Software Engineer

Mobile: +977-9840193890 | prabinchy1...@gmail.com  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN9B8Z07qB7a336TRwju0uPzdXe7NeC%3DtYVvVStcCv3%3DjMpPzQ%40mail.gmail.com.


Re: Data model design questio: graph in database

2024-02-25 Thread Sébastien Hinderer
Dear Mike,

Many thanks for your suggestion!

I find it significantly superior to what I had in mind, in the
sense that I would have had to handle the class types manually, with
the obvious drawbacks (error-prone, not so easy to extend), which
your solution completely avoids.

I will thus definitely use it to go ahead because I do think it does
unblock me and, as you concluded, it's definitely enough to get me
started and even going.

In the long run and for my culture, I do reamin interested in feedback,
especially on whether my approach is flawed or is state of the art and
idiomatic in this environment. If it's flawed, I'd be really curious and
grateful to hear about any other possible alternative.

Many thanks again to you Mike and in advance to any other person who
would participate to this discussion.

Best wishes,

Seb.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ZdsE0Zq_8c4_Cfg4%40om.localdomain.


[no subject]

2024-02-25 Thread Light Ofor
Hello am interested
GitHub:Lyte77
Whatsapp:+2349136040153
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH%3Df_cFL4Wh%3D3OPxoh0jY_Uf-8pDE4QS-Z-65eazBZ101ixnBg%40mail.gmail.com.


[no subject]

2024-02-25 Thread Light Ofor
I would like to join please

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH%3Df_cF6Ng3J4f1KEh5%3Ddp_-QWYpP-tam73WKZajWa6m-f3h2Q%40mail.gmail.com.


Re:Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-25 Thread Dawda Borje Kujabi
I am interested, just wanna get more experience. Email: dawdaborjekuj...@gmail.com Sent from my Huawei phone Original message From: SURAJ TIWARI Date: Sun, 18 Feb 2024, 12:04 pmTo: Django users Subject: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!🚀 Join Our Django WhatsApp Bulk Messaging Project!👋 Hello everyone,Are you looking for an exciting opportunity to gain hands-on experience in Django development? Do you want to work on a meaningful project that leverages WhatsApp for bulk messaging? We're thrilled to invite you to join our dynamic team!🌟 Benefits:Get hands-on experience working on a real-world Django project.Learn how to leverage WhatsApp for bulk messaging, a valuable skill in today's digital landscape.Opportunities for hybrid work, allowing flexibility in your schedule.Collaborate with experienced developers and gain valuable mentorship.Access to cutting-edge tools and technologies.💼 Opportunities Available:Django developersFrontend developersUI/UX designersQuality assurance testers🤝 How to Join:
Simply reply to this message expressing your interest, and we'll provide you with all the necessary details to get started on our project.Let's work together to create something amazing and gain valuable experience along the way! 💻✨Best regards,Suraj Tiwari



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com.




-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/-6nde6bodyrd4we0fb3-24sqvbqupnr2-lw0iz6-w3flv1-a4h6qx-x5tvn1himlln5olikq3ntwky8u9yykaffjsr-web0uj-b1b6cap377tvkjxn2r-d82qfkajynlfdy4ohq-cfx781rjlia8h4v193.1708848553057%40email.android.com.