-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fails to CreateTableUsers when used with GenieAuthentication: ERROR: MethodError: no method matching query(::String)
#41
Comments
SearchLight.Migration.status() and last_up() cause the same error SearchLight.Migration.create_migrations_table has zero methods This happens on 1.7.0 as well. |
downgrading Searchlight to 1.0.2 does not help either... |
Ah... Selecting SQLite in the wizard does not actually set up an sqlite file. I attempted to clarify the Readme to avoid similar confusions in the future: GenieFramework/GenieAuthentication.jl#10 |
Selecting that just installs the dependencies. Valid point about also setting up the db, but I'm not sure it's doable - how do we know what name to give it, how to connect to MySQL/Postgres, etc? |
Maybe a warning log message (not an info log message) along the lines of:
|
@Krastanov good ideas! For interactive setups it would be nice even ask for the data at the REPL (location for sqlite file, postgres host/user/pass etc) and populate the config file. |
@Krastanov we can do this with Julia e.g. via SearchLightPostgreSQL ahead / without Genie app scaffolding: Firstly, we add connection data for using SearchLight, SearchLightPostgreSQL
using YAML
path = SearchLight.DB_PATH
database = "postgres"
filename = "$(database)_$(SearchLight.SEARCHLIGHT_DB_CONFIG_FILE_NAME)"
SearchLight.Generator.newconfig(path; filename)
filepath = joinpath(path, filename)
db_conn_data = YAML.load(open(filepath))
host = ENV["POSTGRES_HOST"]
port = ENV["POSTGRES_PORT"]
username = ENV["POSTGRES_USERNAME"]
password = ENV["POSTGRES_PASSWORD"]
env = "dev"
db_conn_data[env]["host"] = host
db_conn_data[env]["port"] = port
db_conn_data[env]["database"] = database
db_conn_data[env]["username"] = username
db_conn_data[env]["password"] = password
YAML.write_file(filepath, db_conn_data)
database = ENV["POSTGRES_DATABASE"]
db_conn_data[env]["database"] = database
filename = "$(database)_$(SearchLight.SEARCHLIGHT_DB_CONFIG_FILE_NAME)"
filepath = joinpath(path, filename)
YAML.write_file(filepath, db_conn_data) Then, we create the using SearchLight, SearchLightPostgreSQL
path = SearchLight.DB_PATH
database = "postgres"
filename = "$(database)_$(SearchLight.SEARCHLIGHT_DB_CONFIG_FILE_NAME)"
filepath = joinpath(path, filename)
postgres_conn_data = SearchLight.Configuration.load(filepath)
postgres_db_handle = SearchLight.connect(postgres_conn_data)
database = ENV["POSTGRES_DATABASE"]
owner = "postgres"
SearchLight.query("CREATE DATABASE $database OWNER $owner")
SearchLight.query("GRANT all ON DATABASE $database TO $owner")
data_frame = SearchLight.query("SELECT 1 FROM pg_database WHERE datname = '$database'")
println(data_frame[!, 1]) # Union{Missing, Int32}[1]
SearchLight.disconnect(postgres_db_handle) Connect to and use the Finally, we can drop the using SearchLight, SearchLightPostgreSQL
path = SearchLight.DB_PATH
database = "postgres"
filename = "$(database)_$(SearchLight.SEARCHLIGHT_DB_CONFIG_FILE_NAME)"
filepath = joinpath(path, filename)
postgres_conn_data = SearchLight.Configuration.load(filepath)
postgres_db_handle = SearchLight.connect(postgres_conn_data)
database = ENV["POSTGRES_DATABASE"]
SearchLight.query("DROP DATABASE IF EXISTS $database")
data_frame = SearchLight.query("SELECT 1 FROM pg_database WHERE datname = '$database'")
println(data_frame[!, 1]) # Union{Missing, Int32}[]
SearchLight.disconnect(postgres_db_handle) @essenciary Would it make sense to adapt this to SQLite and MySQL and integrate it with SearchLight? Related #46 (comment), #18 (comment) |
Describe the bug
Following the setup instructions for GenieAuthentication, the moment I run the SearchLight migration, I get an error.
Error stacktrace
To reproduce
This happens independently of whether I restart julia between invocations of each command. I am using sqlite
Expected behavior
It should run without error.
Additional context
All of this on a brand new julia environment.
The text was updated successfully, but these errors were encountered: