Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3284878
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:12:14+00:00 2026-05-17T20:12:14+00:00

I’ve written a working grammar to replace dbunit in scala called ScalaDBTest. The whole

  • 0

I’ve written a working grammar to replace dbunit in scala called ScalaDBTest. The whole program works – only took 2 days to write. I got a lot of polishing to do.

Anyway, the grammar I’m using for the DSL to input data into the database is malleable and I’d like some feedback on it.

The basic syntax looks like this. It’s pretty simple:

country:
- country_id: 1, name: "Canada"
- country_id: 2, name: "United States"

This is certainly better than XML or SQL insert statements.

I debated using “:” or “=”. The former looks better, but the latter seems automatic for me to type.

There’s also a concept where you can “label” a record. In a sense, the above syntax was anonymous records. Labels will be an interesting feature because you can use them in a variety of ways.

country:
    record: Canada -> country_id: 1, name: $label # produces "Canada"
    record: UnitedStates -> country_id: 2, name: $label.uncamel # produces "United States"

I dislike this syntax. It’s a little two wordy. Using the “-” doesn’t look right, but if I use an actual command word like “record”, I need to put the “->” to separate them otherwise it looks really bad (it’s not necessary for technical reasons).

$label will simply repeat the label, so you can use the label at the bare minimum as way to reuse the string. $label.uncamel will add spaces where it looks like camel case.

The idea behind labels is to give the APIs a way to access records without having to remember the ids. If you know the country object you want to get is “Canada”, then you can just pass the label “Canada” and it will convert it to a unique id and pull it out of the database.

Here’s an example where you can specify default parameters:

province:
? country_id: 1, nice_weather: true
- province_id: 1, name: "British Columbia"
- province_id: 2, name: "Manitoba", nice_weather: false
- province_id: 3, name: "New York", country_id: 2

Here’s were you see some real power. All of these 3 ‘province’ records will have 4 columns. Since 2 of the provinces are from Canada, they are automatically inherited from the default values. In the 3rd case, we override it with United States for New York. We can mix/match as required.

In practice, this is going to save a lot of typing and cognitive load as we often only care about a few values in practice, and the rest can be mere placeholders to get the database to shut up about missing required fields and so on. This really helps with testing polymorphic objects too.

Here’s another:

article:
? date_create: $now
- article_id: 1, title: "The Fed Sucks"
- article_id: 2, title: null

This snippet shows that you can actually place null values without doing any tricks like in dbUnit. In DbUnit, you have to first create a transformer that translates a custom string (like “[NULL]”) to actual null value.

In fact, we can be way more expressive and offer a variety of expressions and functions to help generate data. For example, $now returns a properly formatted sql date of today’s date/time. I will expand on these kinds of features to help make writing test data easier.

Anyway, I’m looking for help to really clean up the syntax. I can make any change, and since this is fresh, I’d like to make it really snazzy from the start rather than change it later.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:12:15+00:00Added an answer on May 17, 2026 at 8:12 pm

    I will suggest to extent the initial syntax for the label in the following ways:

    1. Segment/Group label by column name.

      country: [label:name]

      – country_id: 1, name: “Canada”

      – country_id: 2, name: “United States”
    2. Segment/Group label by column index, to minimize typing.

      country: [label:2]

      – country_id: 1, name: “Canada”

      – country_id: 2, name: “United States”
    3. Single Recod

      country:

      -[label:2] country_id: 1, name: “Canada”

      -[label:name] country_id: 2, name: “United States”

    You can eliminate the index based labels if you dont want to track the number of columns in the record.

    If you wish to extend the tool you can add another attributes like concurrency for the record groups, for instance create 5K rows with 5 Threads will be something like this:

    country: [label:name] [concurrency:5]

    -[label:2] country_id: 1, name: “Canada”

    -[label:name] country_id: 2, name: “United States”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.