Table of Contents

Introduction Installation Projects Tables Inserts Searches Updates Deletes CLI Production Installation Partial Autoscaling Good Practices Conclusion

Inserts - Flaarum Tutorials (Python)    Golang

Insertion Method

The insert class expects a dict for its data. Accepted types in the dict are int and str Flaarum provides no statements for inserts. One would need to use a function call for insertions.

Sample Code


import pyflaarum

cl = pyflaarum.flaacl("127.0.0.1", "not-yet-ready", "first_proj")

try:
  cl.ping()
except:
  print("error connecting")


try:
  to_insert = {"field1": "data", "field2": "data too", "field3": 456}
  ret_id = cl.insert_row("table1", to_insert)
  print(ret_id)
except pyflaarum.flaa_error as fe:
  if fe.code == 11:
    print("print server error")
    print(fe.message)
  elif fe.code == 20:
    print("validation error")
    print(fe.message)
except Exception as e:
  print(e)

The flaarum lib expects the address of the database, its keystring (like a password) and the name of the project.

All Error Codes

< Previous Next >