# Check if collection/schema already exists and if populated

**URL:** <https://forum.weaviate.io/t/check-if-collection-schema-already-exists-and-if-populated/1227>\
**Category:** Support\
**Created:** [January 13, 2024, 8:14pm UTC](https://forum.weaviate.io/t/check-if-collection-schema-already-exists-and-if-populated/1227 "2024-01-13T20:14:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjalex](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/rjalex/32/807_2.png) [@rjalex](https://forum.weaviate.io/u/rjalex)\
**Post date:** [January 13, 2024, 8:14pm UTC](https://forum.weaviate.io/t/check-if-collection-schema-already-exists-and-if-populated/1227/1 "2024-01-13T20:14:55Z")

</div>

SOLVED!

In my scripts I usually have a first section that defines a collection and then populates it, followed by a second section with the queries.

Of course if run this again it will throw an error when attempting to create the collection.

What is the correct Python V4 way of finding if collection exists and/or if it has objects inside it, so that I could skip the creation section and go directly to the queries?

Tried an horrible shortcut by deleting it with `wclient.collections.delete(collname)`  
since my learning collections are small, but of course if this was a real project with many objects this would be a waste.  
Thanks

---

<div class="post-metadata">

**Author:** ![rjalex](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/rjalex/32/807_2.png) [@rjalex](https://forum.weaviate.io/u/rjalex)\
**Post date:** [January 13, 2024, 8:38pm UTC](https://forum.weaviate.io/t/check-if-collection-schema-already-exists-and-if-populated/1227/2 "2024-01-13T20:38:40Z")

</div>

Looking through the collection class in the code gave me the solution:

```auto
if not wclient.collections.exists(collname):
    define, create and add objects

```

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [January 15, 2024, 6:38pm UTC](https://forum.weaviate.io/t/check-if-collection-schema-already-exists-and-if-populated/1227/3 "2024-01-15T18:38:22Z")

</div>

That’s right.

One thing we (or at least I) do in recipes or python notebooks is to delete the class without even checking, so we make sure we have a brand new class to work with.

THanks for sharing 🙂
