# Automatically create Model via Pystardog, not available in Studio

**URL:** https://community.stardog.com/t/automatically-create-model-via-pystardog-not-available-in-studio/4798
**Category:** Stardog Studio
**Created:** [January 11, 2024, 9:07pm UTC](https://community.stardog.com/t/automatically-create-model-via-pystardog-not-available-in-studio/4798 "2024-01-11T21:07:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hall00ween](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/hall00ween/32/1752_2.png) [@hall00ween](https://community.stardog.com/u/hall00ween)
#### Post date: [January 11, 2024, 9:07pm UTC](https://community.stardog.com/t/automatically-create-model-via-pystardog-not-available-in-studio/4798/1 "2024-01-11T21:07:10Z")

</div>

Hi,

I create a .ttl file in Python containing a named graph. Then, I use `pystardog` to push that .ttl file to the database I built:

```auto
# Convert named graph file into Stardog content
stardog_named_graph = stardog.content.ImportFile(named_graph_file_path, content_type=stardog.content_types.TURTLE)

# Push to Stardog Cloud
with stardog.Connection(database=build_database, **conn_details) as conn:
     conn.begin()
     conn.add(stardog_named_graph, graph_uri=urn, server_side=False)
     conn.commit()

```

However, when I go to Stardog Studio they are not located under 'Models':

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/6/60496d335505cc2f1c8eb129135e486a919bcacd.png)

I am able to get them to appear but clicking 'Create Model' and then choosing the "Named Graph" and adding a "Model Name".  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/1/1af6c8cee50e2ad72c7689d3ca616ae5b789d6d6.png)

Is there a way to automate that last step? This is an important step because our knowledge graph will be rebuilt routinely and any user using Stardog Studio will have to add the model again after each rebuild.

Any thoughts / solutions?

---

<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 12, 2024, 6:53am UTC](https://community.stardog.com/t/automatically-create-model-via-pystardog-not-available-in-studio/4798/2 "2024-01-12T06:53:19Z")

</div>

Hi,

you can add the reasoning schema using the CLI with the [`reasoning schema --add`](https://docs.stardog.com/inference-engine/#reasoning-schemas) command. For example:

```auto
reasoning schema --add MyModel --graphs urn:MyModel -- myDB

```

In pystardog, you should be able to modify the [`reasoning.schemas`](https://docs.stardog.com/operating-stardog/database-administration/database-configuration#reasoningschemas) option with an `Admin` connection on the selected `db` as follows:

```auto
db.set_options({"reasoning.schemas": ["default=tag:stardog:api:context:schema", "MyModel=urn:MyModel"]})

```

Best regards  
Lars
