Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass query parameters through to metamodel syntax #446

Open
riastradh-probcomp opened this issue Jul 12, 2016 · 0 comments
Open

pass query parameters through to metamodel syntax #446

riastradh-probcomp opened this issue Jul 12, 2016 · 0 comments

Comments

@riastradh-probcomp
Copy link
Contributor

Currently we do not distinguish

CREATE GENERATOR g FOR p USING m ("foo")

from

CREATE GENERATOR g FOR p USING m ('foo')

which is not at the moment blocking anything (hence the stall of #410), but which may be worth fixing soon. Furthermore, passing a verbatim string through, e.g. to provide the source code in

CREATE GENERATOR g FOR p USING cgpm (
    MODEL x GIVEN y USING venturescript (source = 'assume x = 42; ...')
)

as we kludgily do in

bdb.execute('''
CREATE GENERATOR g0 FOR satellites USING cgpm (
apogee NORMAL,
LATENT kepler_cluster_id NUMERICAL,
LATENT kepler_noise NUMERICAL,
MODEL kepler_cluster_id, kepler_noise, period
GIVEN apogee, perigee
USING venturescript (source = "{}"),
MODEL perigee GIVEN apogee USING linreg,
MODEL class_of_orbit GIVEN apogee, period, perigee
USING forest (k = 4),
SUBSAMPLE 100,
)
'''.format(kepler_source))
with Python string formatting, is not easy to do reliably. That fragment just assumes no " appears in the VentureScript code, and abuses "..." quotation, which in SQL means names, with '...' meaning strings. No quotation should be necessary on the user's part -- it should be possible to do

bdb.execute('CREATE GENERATOR ... USING venturescript (source = ?) ...', (venturescript,))

and get the same intended effect reliably.

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

No branches or pull requests

1 participant