Ability to specify schema and data without a filename
See original GitHub issueCurrently 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:
- Created 3 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This enhancement is in version 2.2.0. Thanks!
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