# Pystardog reasoning not working

**URL:** <https://community.stardog.com/t/pystardog-reasoning-not-working/5258>\
**Category:** Support\
**Created:** [January 31, 2025, 2:27am UTC](https://community.stardog.com/t/pystardog-reasoning-not-working/5258 "2025-01-31T02:27:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![habat](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/habat/32/1762_2.png) [@habat](https://community.stardog.com/u/habat)\
**Post date:** [January 31, 2025, 2:27am UTC](https://community.stardog.com/t/pystardog-reasoning-not-working/5258/1 "2025-01-31T02:27:51Z")

</div>

Hi, I am trying to use SPARQL with pystardog to return data but cannot get reasoning to work.

Using the following code:

```auto
#conn_details removed from support post

database = 'sqlBehaviors'

with stardog.Connection(database, **conn_details) as conn:
    query = '''

        select ?test {
            ?test a sql:Behavior . 
        }

            '''
results = conn.select(query, reasoning=True)

for result in results['results']['bindings']:
    print(result)

```

If run this SPARQL query in Stardog studio or the equivalent of the query in explorer, with reasoning enabled and the correct reasoning schema then I am able to return the expected data.

The reasoning schema is named "sql" and is configured in the database "sql=tag:stardog:designer:sql:model"

I have tried stating the named graphs and stardog:context:all but had no results for the pystardog approach but this returns nothing. I cannot find anything in the documentation that explains why the reasoning doesn't work or how to specify which reasoning schema to use.

I am able to query assertions but not reasoning.

Can someone advise

---

<div class="post-metadata">

**Author:** ![Lars\_Heling](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/lars_heling/32/1657_2.png) [@Lars\_Heling](https://community.stardog.com/u/Lars_Heling)\
**Post date:** [January 31, 2025, 6:25am UTC](https://community.stardog.com/t/pystardog-reasoning-not-working/5258/2 "2025-01-31T06:25:11Z")

</div>

Hi,

It is not possible to set a reasoning schema for a query with `pystardog`. This would require passing the parameter `schema=sql` in the request to the server. This parameter, however, is currently not supported in the `pystardog` API (see also [this GitHub issue](https://github.com/stardog-union/pystardog/issues/170)). Only the default reasoning schema is supported. As a result, if you set the `sql` as the default reasoning schema, then your query should work. You can do this in the database property "Schema Graphs" (`reasoning.schema.graphs`) and add your model to the list. For example, you can set the property to `tag:stardog:api:context:schema,tag:stardog:designer:sql:model`.

Best regards

Lars

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [September 8, 2025, 3:31pm UTC](https://community.stardog.com/t/pystardog-reasoning-not-working/5258/3 "2025-09-08T15:31:12Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [May 8, 2026, 7:49pm UTC](https://community.stardog.com/t/pystardog-reasoning-not-working/5258/4 "2026-05-08T19:49:31Z")

</div>


