Skip to content

Conversation

samhaese
Copy link

@samhaese samhaese commented Apr 18, 2025

When I'm working with markup files in Python I usually use one of these packages:

I noticed that all of them have pretty much the same API:

  • dump writes a file
  • dumps returns a string
  • load parses a file
  • loads parses a string

I added that API to your package because it could make it easier for people to adopt it. I would understand if you rejected this change.

Example:

import pydbml

with open('test_file.dbml', 'r') as f:
    db = pydbml.load(f)

with open('test_save.dbml', 'w') as f:
    pydbml.dump(db)

s = """Table users {
    id integer
    user varchar
    role varchar
    created_at timestamp
}"""

db2 = pydbml.loads(s)

print(pydbml.dumps(db))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant