question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to specify schema and data without a filename

See original GitHub issue

Currently you use the library like this:

import yamale
schema = yamale.make_schema('./schema.yaml')

# Create a Data object
data = yamale.make_data('./data.yaml')

# Validate data against the schema. Throws a ValueError if data is invalid.
yamale.validate(schema, data)

It would be really useful if there was an option to provide the schema and data as Python strings instead - that way the could be loaded from a database or from an incoming HTTP request.

Something like this could work

import yamale

schema = yamale.make_schema(content="""
name: str()
age: int(max=200)
height: num()
awesome: bool()
""")

data = yamale.make_data(content="""
name: Bill
age: 26
height: 6.2
awesome: True
""")

yamale.validate(schema, data)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mildebrandtcommented, Jun 26, 2020

This enhancement is in version 2.2.0. Thanks!

0reactions
blopkercommented, Jun 25, 2020

Hey @simonw, thank you for your contribution. Also, thanks for reminding us we still support Python 2. I’ve made a ticket to address that for our next major version: https://github.com/23andMe/Yamale/issues/106

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I specify the schema to run an sql file against in the ...
The only problem is I want to be able to specify in this command what schema to run the script against. I could...
Read more >
Documentation: 15: 5.9. Schemas - PostgreSQL
A database contains one or more named schemas, which in turn contain tables. Schemas also contain other kinds of named objects, including data...
Read more >
Schema.ini File (Text File Driver) - Microsoft Learn
The schema information file provides the IISAM with information about the general format of the file, the column name and data type information, ......
Read more >
Using schema auto-detection | BigQuery - Google Cloud
Schema auto-detection enables BigQuery to infer the schema for CSV, JSON, or Sheets data. Schema auto-detection is available when you load data into...
Read more >
Schema Evolution and Compatibility - Confluent Documentation
FULL compatibility means schemas are both backward and forward compatible. Schemas evolve in a fully compatible way: old data can be read with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found